@font-face {
  font-family: 'Courier Prime';
  src: url('../fonts/courier-prime-regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Courier Prime';
  src: url('../fonts/courier-prime-bold.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: 'Courier Prime';
  src: url('../fonts/courier-prime-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: 'Courier Prime';
  src: url('../fonts/courier-prime-bold-italic.woff2') format('woff2');
  font-style: italic;
  font-weight: 700;
  font-display: swap;
}

:root[data-theme="dark"] {
  --bg-color: #140a12;
  --bg-gradient: radial-gradient(circle at 50% 0%, #2e1224 0%, #140a12 85%);
  --accent: #ec4899;
  --text-main: #f472b6;
  --text-muted: #f4a8c4;
  --card-bg: rgba(38, 18, 32, 0.65);
  --card-hover-bg: rgba(56, 24, 46, 0.85);
  --header-bg: rgba(30, 13, 25, 0.55);
  --shadow: 0 12px 36px -10px rgba(0, 0, 0, 0.65);
  --input-bg: rgba(20, 10, 18, 0.6);
  --on-accent: #260817;
  --focus-ring: #fbcfe8;
}

:root[data-theme="light"] {
  --bg-color: #fff5f7;
  --bg-gradient: radial-gradient(circle at 50% 0%, #fce7f3 0%, #fff5f7 85%);
  --accent: #db2777;
  --text-main: #be185d;
  --text-muted: #9d4b68;
  --card-bg: rgba(255, 255, 255, 0.78);
  --card-hover-bg: #ffffff;
  --header-bg: rgba(255, 255, 255, 0.55);
  --shadow: 0 12px 34px -10px rgba(219, 39, 119, 0.12);
  --input-bg: rgba(255, 255, 255, 0.85);
  --on-accent: #ffffff;
  --focus-ring: #9d174d;
}

:root {
  --accent-glow: color-mix(in srgb, var(--accent) 28%, transparent);
  --card-border: color-mix(in srgb, var(--accent) 20%, transparent);
  --card-hover-border: color-mix(in srgb, var(--accent) 55%, transparent);
}

*, *::before, *::after {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html, body { width: 100%; overflow-x: hidden; }

::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 3px solid var(--focus-ring); outline-offset: 3px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* American Typewriter where available, locally hosted Courier Prime fallback. */
body, h1, h2, h3, h4, input, button, select, textarea,
.calendar-title, .weather-temp, .section-title {
  font-family: 'American Typewriter', 'Courier Prime', 'Courier New', Courier, monospace !important;
  letter-spacing: 0.02em;
}

body {
  background-color: var(--bg-color);
  background-image: var(--bg-gradient);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: calc(1.5rem + env(safe-area-inset-top)) 1.25rem calc(2rem + env(safe-area-inset-bottom));
  transition: background-color 0.4s ease, color 0.4s ease;
  position: relative;
}

#ambient-glow {
  position: fixed; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  width: 85vw; height: 85vh; border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow) 0%, rgba(0,0,0,0) 70%);
  pointer-events: none; z-index: 0; opacity: 0.55;
  transition: background 0.6s ease, opacity 0.6s ease;
  filter: blur(80px);
}

#weather-atmosphere {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  opacity: 0; transition: opacity 0.45s ease, background 0.45s ease;
}
body[data-weather="cloud"] #weather-atmosphere {
  opacity: 0.3;
  background: linear-gradient(180deg, rgba(148, 163, 184, 0.22), transparent 55%);
}
body[data-weather="fog"] #weather-atmosphere {
  opacity: 0.52;
  background: linear-gradient(180deg, rgba(203, 213, 225, 0.32), rgba(148, 163, 184, 0.08) 65%, transparent);
}
body[data-weather="wind"] #weather-atmosphere {
  opacity: 0.24;
  background: linear-gradient(115deg, transparent 18%, rgba(244, 114, 182, 0.12) 48%, transparent 76%);
}
body[data-weather="rain"] #weather-atmosphere {
  opacity: 0.38;
  background: linear-gradient(180deg, rgba(30, 64, 175, 0.2), rgba(15, 23, 42, 0.08) 58%, transparent);
}
body[data-weather="snow"] #weather-atmosphere {
  opacity: 0.4;
  background: linear-gradient(180deg, rgba(219, 234, 254, 0.28), rgba(191, 219, 254, 0.08) 60%, transparent);
}
body[data-weather="storm"] #weather-atmosphere {
  opacity: 0.58;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.48), rgba(49, 46, 129, 0.13) 60%, transparent);
}

#sakura-canvas {
  position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0;
}

.container { width: 100%; max-width: 1380px; margin: 0 auto; position: relative; z-index: 1; }

.glass-panel {
  background: var(--card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--card-border);
  border-radius: 24px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: border-color 0.3s ease, box-shadow 0.3s ease, background-color 0.4s ease, filter 0.3s ease;
}

.glass-panel::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  border-radius: inherit;
  background: radial-gradient(500px circle at 50% 40%, var(--glow-color, rgba(244, 114, 182, 0.18)), transparent 65%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: 2;
}

.glass-panel:hover::after { opacity: 1; }

.glass-panel:hover {
  border-color: color-mix(in srgb, var(--accent) 45%, var(--card-hover-border));
  box-shadow: 0 18px 38px -18px rgba(0, 0, 0, 0.72);
}

/* Offline Monochrome Card Styling */
.card.service-down {
  border-color: var(--card-border) !important;
  box-shadow: none !important;
}
.card.service-down::after {
  display: none !important;
}
.card.service-down .card-icon {
  filter: grayscale(100%) opacity(0.5) !important;
}

header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 2rem; padding: 0.75rem 1.25rem;
  border-radius: 24px;
  position: relative; z-index: 10;
  gap: 0.75rem;
}

.brand { display: flex; align-items: center; gap: 0.85rem; user-select: none; flex-shrink: 0; }
.brand-icon {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(244, 114, 182, 0.15); color: #f472b6;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
  box-shadow: 0 8px 18px -10px rgba(0, 0, 0, 0.72);
}
.brand-logo { width: 100%; height: 100%; object-fit: cover; display: block; }
.brand-icon picture { width: 100%; height: 100%; display: block; }

.brand-text {
  transition: opacity 0.2s ease, transform 0.25s ease;
  white-space: nowrap; overflow: hidden;
  transform-origin: left center;
  max-width: 15rem;
  will-change: transform, opacity;
}
.brand-text h1 { font-size: 1.15rem; line-height: 1.1; color: var(--text-main); }
.brand-text p { font-size: 0.75rem; color: var(--text-muted); }

header.search-active .brand-text { opacity: 0; transform: scaleX(0); max-width: 0; pointer-events: none; }
header.search-active .clock-widget { display: none; }

.header-search-form {
  flex: 1 1 auto; min-width: 0; width: auto; opacity: 0; overflow: hidden;
  display: flex; align-items: center; position: relative;
  transform: scaleX(0);
  transform-origin: right center;
  transition: transform 0.3s ease, opacity 0.25s ease;
  z-index: 3;
  will-change: transform, opacity;
}

header.search-active .header-search-form { transform: scaleX(1); opacity: 1; margin: 0 0.5rem; }

.header-search-input {
  width: 100%; padding: 0.65rem 1rem;
  border-radius: 99px; background: var(--input-bg);
  border: 1px solid var(--card-border); color: var(--text-main);
  font-size: 0.85rem; outline: none;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.header-search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 8px 18px -12px rgba(0, 0, 0, 0.72);
}

.header-right { display: flex; align-items: center; gap: 1rem; position: relative; z-index: 3; flex-shrink: 0; }
.clock-widget { text-align: right; }
.time { font-size: 0.875rem; font-variant-numeric: tabular-nums; line-height: 1.2; color: var(--text-main); }
.date { font-size: 0.7rem; color: var(--text-muted); }

.theme-toggle, .search-toggle {
  background: transparent; border: 1px solid var(--card-border);
  color: var(--text-main); min-width: 44px; min-height: 44px; border-radius: 12px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.15s ease; touch-action: manipulation;
}
.theme-toggle:hover, .search-toggle:hover { background: rgba(244, 114, 182, 0.12); border-color: var(--accent); }
.theme-toggle:active, .search-toggle:active { transform: scale(0.94); }
.search-toggle[aria-expanded="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }



[data-theme="dark"] #icon-moon { display: none; }
[data-theme="dark"] #icon-sun { display: block; }
[data-theme="light"] #icon-sun { display: none; }
[data-theme="light"] #icon-moon { display: block; }

.dashboard-layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 2rem;
  align-items: start;
}

.main-content { display: flex; flex-direction: column; gap: 2rem; }

.section-title {
  font-size: 0.95rem; color: var(--text-muted); margin-bottom: 0.85rem;
  display: flex; align-items: center; gap: 0.5rem;
}

.panel-title { margin-bottom: 0; border: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.5rem;
  perspective: 1000px;
}

.card {
  text-decoration: none; color: inherit;
  cursor: pointer;
  transition: transform 0.15s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.3s ease, box-shadow 0.3s ease;
  min-height: 235px; height: 100%;
}

.card:hover { transform: translateY(-2px) scale(1.01); }
.card.service-stream { --glow-color: rgba(99, 102, 241, 0.35); }
.card.service-meta { --glow-color: rgba(236, 72, 153, 0.35); }
.card.service-nuvio { --glow-color: rgba(244, 63, 94, 0.35); }

.card-inner {
  padding: 1.25rem; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 100%; height: 100%; width: 100%; position: relative; z-index: 3;
}

.card-icon {
  width: 75%; height: 75%; max-width: 170px; max-height: 170px; aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  position: relative; margin: auto; transition: transform 0.3s ease;
}
.card-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: 20px; display: block; }
.card-icon[data-service="stream"] { filter: drop-shadow(0 6px 16px rgba(99, 102, 241, 0.45)); }
.card-icon[data-service="meta"] { filter: drop-shadow(0 6px 16px rgba(236, 72, 153, 0.45)); }
.card-icon[data-service="nuvio"] { filter: drop-shadow(0 6px 16px rgba(244, 63, 94, 0.45)); }

.card-copy { display: grid; justify-items: center; gap: 0.2rem; margin-top: 0.75rem; }
.card-title { color: var(--text-main); font-size: 0.9rem; }
.card-status {
  color: var(--text-muted); font-size: 0.7rem; padding: 0.18rem 0.5rem;
  border: 1px solid var(--card-border); border-radius: 999px;
}
.card.service-up .card-status {
  color: var(--text-muted);
  border-color: var(--card-border);
  background: color-mix(in srgb, var(--accent) 7%, transparent);
}
.card.service-down .card-status {
  color: var(--text-muted);
  border-color: var(--card-border);
  filter: grayscale(100%);
  opacity: 0.62;
}

/* News Widget Styling */
.news-card { padding: 1.5rem; }
.news-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.75rem; position: relative; z-index: 3;
}
.news-tabs { display: flex; gap: 0.5rem; }
.news-tab {
  background: transparent; border: 1px solid var(--card-border);
  color: var(--text-muted); font-size: 0.75rem;
  min-height: 44px; padding: 0.45rem 0.85rem; border-radius: 12px; cursor: pointer;
  transition: all 0.2s ease;
}
.news-tab.active { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.news-list {
  display: flex; flex-direction: column; gap: 0.85rem;
  overflow-y: auto; padding-right: 0.5rem; position: relative; z-index: 3;
}
.news-list { max-height: 340px; }
.news-list::-webkit-scrollbar { width: 4px; }
.news-list::-webkit-scrollbar-thumb { background: var(--card-border); border-radius: 4px; }
.news-status { font-size: 0.8rem; color: var(--text-muted); text-align: center; padding: 1rem; }
#news-sentinel { height: 1px; }

.news-item {
  text-decoration: none; color: inherit; display: flex; flex-direction: column; gap: 0.35rem;
  padding: 0.75rem 0.85rem; border-radius: 14px; background: rgba(0,0,0,0.08);
  border: 1px solid transparent; transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.news-item:hover {
  background: var(--card-hover-bg); border-color: var(--card-hover-border);
  transform: translateX(4px);
}
.news-title {
  font-size: 0.95rem; line-height: 1.35; color: var(--text-main);
  overflow-wrap: anywhere; word-break: break-word;
}
.news-meta { font-size: 0.8rem; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; }

.side-widgets { display: flex; flex-direction: column; gap: 2rem; }
.widget-box { padding: 1.25rem; min-height: 235px; }

.weather-toggle { display: flex; gap: 0.5rem; margin-bottom: 1rem; position: relative; z-index: 3; }
.weather-btn {
  flex: 1; background: transparent; border: 1px solid var(--card-border);
  color: var(--text-muted); font-size: 0.75rem;
  min-height: 44px; padding: 0.45rem; border-radius: 10px; cursor: pointer; text-align: center;
  transition: all 0.2s ease;
}
.weather-btn.active { background: rgba(244, 114, 182, 0.15); border-color: var(--accent); color: var(--text-main); }

.weather-current-link {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; padding-bottom: 0.75rem; border-bottom: 1px solid var(--card-border);
  position: relative; z-index: 3; text-decoration: none; color: inherit;
  border-radius: 12px; transition: background 0.2s ease; cursor: pointer;
}
.weather-current-link:hover { background: rgba(244, 114, 182, 0.08); }

.weather-temp { font-size: 2.1rem; color: var(--text-main); line-height: 1; }
.weather-desc { font-size: 0.825rem; color: var(--text-muted); margin-top: 0.25rem; }
.weather-shortterm { font-size: 0.775rem; color: var(--accent); margin-top: 0.25rem; font-weight: bold; }
.weather-icon { font-size: 2.2rem; }

.weather-retry-row {
  display: flex; align-items: center; gap: 0.5rem; margin-top: 0.4rem;
  font-size: 0.7rem; color: var(--text-muted);
}
.weather-retry-row[hidden] { display: none; }
.weather-retry-btn {
  background: rgba(244, 114, 182, 0.12); border: 1px solid var(--accent);
  color: var(--text-main); border-radius: 99px; min-height: 44px; padding: 0.35rem 0.8rem;
  font-size: 0.7rem; cursor: pointer; font-family: inherit;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.weather-retry-btn:hover { background: rgba(244, 114, 182, 0.22); transform: scale(1.04); }
.weather-retry-btn:active { transform: scale(0.97); }

.weather-effect-status {
  display: inline-flex; align-items: center; gap: 0.35rem;
  margin-top: 0.45rem; padding: 0.28rem 0.55rem;
  border: 1px solid var(--card-border); border-radius: 999px;
  color: var(--text-muted); font-size: 0.7rem;
  background: color-mix(in srgb, var(--card-bg) 78%, transparent);
}
.weather-effect-status::before { content: ''; width: 0.42rem; height: 0.42rem; border-radius: 50%; background: var(--accent); }
.weather-alert {
  margin: 0.8rem 0; padding: 0.7rem 0.8rem; border-radius: 12px;
  border: 1px solid rgba(251, 191, 36, 0.5); color: #fde68a;
  background: rgba(120, 53, 15, 0.26); font-size: 0.75rem; line-height: 1.4;
  position: relative; z-index: 3;
}
:root[data-theme="light"] .weather-alert { color: #78350f; background: #fffbeb; }
.weather-alert[hidden] { display: none; }

.forecast-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.4rem; text-align: center; position: relative; z-index: 3; }
.forecast-day {
  background: rgba(0,0,0,0.06); padding: 0.5rem 0.2rem; border-radius: 12px;
  display: flex; flex-direction: column; gap: 0.2rem; align-items: center;
}
.forecast-date { font-size: 0.775rem; color: var(--text-muted); }
.forecast-icon { font-size: 1rem; }
.forecast-temps { display: flex; gap: 0.25rem; justify-content: center; font-size: 0.8rem; }
.forecast-temp-high { color: var(--text-main); font-weight: 600; }
.forecast-temp-low  { color: var(--text-muted); }

.calendar-header {
  display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem;
  position: relative; z-index: 3;
}
.calendar-title { font-size: 1.075rem; color: var(--text-main); }
.calendar-nav { display: flex; gap: 0.25rem; }
.cal-btn {
  background: transparent; border: 1px solid var(--card-border); color: var(--text-main);
  width: 44px; height: 44px; border-radius: 10px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; font-size: 0.85rem;
}
.cal-btn:hover { background: var(--card-hover-bg); }

.calendar-days-header {
  display: grid; grid-template-columns: repeat(7, 1fr); text-align: center;
  font-size: 0.8rem; color: var(--text-muted); margin-bottom: 0.5rem;
  position: relative; z-index: 3;
}
.calendar-grid {
  display: grid; grid-template-columns: repeat(7, 1fr); gap: 0.25rem; text-align: center;
  position: relative; z-index: 3;
}
.cal-day {
  aspect-ratio: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-size: 0.875rem; border-radius: 8px;
  position: relative; color: var(--text-main); cursor: default;
}
.cal-day.other-month { opacity: 0.3; }
.cal-day.today { background: var(--accent); color: var(--on-accent); box-shadow: 0 7px 14px -9px rgba(0, 0, 0, 0.7); }
.cal-day[role="button"] { cursor: pointer; }
.cal-day.has-event::after {
  content: ''; width: 4px; height: 4px; background: #38bdf8;
  border-radius: 50%; position: absolute; bottom: 3px;
}
.cal-day.today.has-event::after { background: #ffffff; }

.event-tooltip {
  font-size: 0.85rem; color: var(--text-muted); margin-top: 0.5rem;
  min-height: 1.25rem; position: relative; z-index: 3; text-align: center;
}

.site-footer { margin-top: 3.5rem; text-align: center; font-size: 0.75rem; color: var(--text-muted); }

/* Fishies game embed — bottom of dashboard. Fixed-aspect-ratio (4:3, matching
   the packaged Scratch stage's native 480x360) box so the embedded app can
   never clip or overflow; the TurboWarp runtime inside the iframe handles
   its own internal letterboxing via resizeMode: "preserve-ratio". */
.game-card { padding: 1.5rem; margin-top: 2rem; }
.game-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem; border-bottom: 1px solid var(--card-border);
  padding-bottom: 0.75rem; position: relative; z-index: 3;
}
.game-frame-wrapper {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  border-radius: 14px;
  overflow: hidden;
  background: #000000;
}
.game-iframe {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  border: 0; display: block;
}
.game-iframe[hidden] { display: none; }
.game-launch {
  position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
  display: grid; place-content: center; justify-items: center; gap: 0.65rem;
  color: var(--text-main); background:
    radial-gradient(circle at 50% 38%, rgba(244, 114, 182, 0.2), transparent 35%),
    linear-gradient(160deg, rgba(20, 10, 18, 0.94), rgba(46, 18, 36, 0.86));
  cursor: pointer; font: inherit;
}
.game-launch-mark { font-size: 2rem; }
.game-launch-title { font-size: 1.05rem; }
.game-launch-copy { color: var(--text-muted); font-size: 0.75rem; }
.game-launch:hover .game-launch-title { color: var(--accent); }
.game-launch[hidden] { display: none; }

@media (min-width: 961px) {
  .grid { align-items: stretch; }
  .card { min-height: 275px; }
}

@media (max-width: 960px) {
  .dashboard-layout { grid-template-columns: 1fr; }
  .side-widgets { order: 2; }
  .main-content { order: 1; }
  .card { min-height: 235px !important; }
}
@media (max-width: 640px) {
  header { margin-bottom: 1.25rem; padding: 0.65rem 0.85rem; }
  .clock-widget { display: none; }
  .header-right { gap: 0.45rem; }
  header.search-active .theme-toggle { display: none; }
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.65rem; }
  .card { min-height: 145px !important; }
  .card-inner { padding: 0.7rem 0.35rem; }
  .card-icon { width: 82px; height: 82px; margin: 0; }
  .card-copy { margin-top: 0.55rem; }
  .card-title { font-size: 0.72rem; }
  .card-status { font-size: 0.7rem; padding: 0.2rem 0.35rem; }
  .game-frame-wrapper { aspect-ratio: 4 / 3; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .card, .brand-text, .header-search-form, #ambient-glow, #weather-atmosphere { transition: none; }
  .card, .news-item:hover, .weather-retry-btn:hover { transform: none !important; }
  #ambient-glow { filter: blur(48px); }
}
