:root {
  --silver-0: #ececec;
  --silver-1: #cfcfcf;
  --silver-2: #9a9a9a;
  --silver-3: #6c6c6c;
  --ink: #1c1c1c;
  --green-0: #d4f59a;
  --green-1: #8ed43a;
  --green-2: #5eaa18;
  --green-3: #3e7c0e;
  --tile-gap: 10px;
  --focus: #ffffff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Noto Sans", "Segoe UI", sans-serif;
  color: #fff;
  background: #6a6a6a;
}

button, input, select, textarea { font-family: inherit; }

.shell {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: 18px 46px 14px;
  user-select: none;
  background:
    radial-gradient(80% 62% at 50% 38%, var(--silver-0) 0%, #d8d8d8 24%, var(--silver-1) 46%, var(--silver-2) 72%, var(--silver-3) 100%);
}

.top {
  position: relative;
  height: 74px;
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.channels {
  display: flex;
  align-items: flex-end;
  gap: 34px;
  padding-bottom: 8px;
}

.channel {
  appearance: none;
  background: none;
  border: 0;
  padding: 4px 2px 8px;
  color: #5a5a5a;
  font-size: 22px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-transform: lowercase;
  cursor: pointer;
  line-height: 1;
}

.channel.active {
  color: #fff;
  font-size: 30px;
  font-weight: 600;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.35), 0 6px 16px rgba(0, 0, 0, 0.18);
}

.channel.is-focused {
  box-shadow: inset 0 -3px 0 #fff;
}

.sound-toggle {
  position: absolute;
  left: 0;
  top: 10px;
  margin: 0;
  z-index: 2;
}

.sound-toggle .checkbox-label {
  color: #3a3a3a;
  font-weight: 600;
}

.profile {
  position: absolute;
  right: 0;
  top: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
  border: 0;
  background: none;
  color: #fff;
  cursor: pointer;
}

.profile-text {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}

.gamertag {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.1;
}

.gamerscore {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
}

.g-badge {
  width: 16px;
  height: 16px;
  border: 1.5px solid #fff;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.profile img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.92);
  background: #f4f4f4;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}

.profile.is-focused img {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
  margin-top: 8px;
}

.view { height: 100%; }

.home-grid {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(160px, 18vw) 1fr 1fr minmax(160px, 18vw);
  grid-template-rows: repeat(3, minmax(0, 1fr));
  gap: var(--tile-gap);
}

.tile {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  overflow: hidden;
  border: 3px solid transparent;
  background: #111 center / cover no-repeat;
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.tile.is-focused,
.thumb.is-focused,
.thumb.is-current {
  border-color: var(--focus);
}

.btn-long.is-focused,
.btn-short.is-focused,
.input-field.is-focused {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.tile:hover:not(.is-focused) { border-color: rgba(255, 255, 255, 0.4); }

.span-2 { grid-column: span 2; }

.tile.hero {
  grid-row: span 2;
  background-position: center 62%;
}

.tile.hero .label {
  font-size: clamp(16px, 1.7vw, 22px);
  font-weight: 500;
  padding-bottom: 12px;
}

.tile .label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 28px 12px 10px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.78));
  font-size: 15px;
  font-weight: 600;
  line-height: 1.2;
}

.tile.system {
  background: linear-gradient(180deg, #96dc45 0%, #69b61e 46%, #4b9613 100%);
}

.tile.system::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 46%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent);
  pointer-events: none;
}

.tile.system .glyph {
  position: absolute;
  left: 50%;
  top: 40%;
  width: 58%;
  height: 52%;
  transform: translate(-50%, -50%);
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.18));
}

.tile.system .label {
  background: none;
  padding: 0 14px 12px;
  font-size: 18px;
}

.logo-tile {
  background: #f3f3f3 url("../images/logo.webp") center / cover no-repeat;
}

.logo-tile .label {
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.72));
}

.hintbar {
  flex: none;
  height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #f7f7f7;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  font-size: 15px;
  font-weight: 500;
}

.hints { display: flex; gap: 22px; align-items: center; }

.hint { display: inline-flex; align-items: center; }

.face {
  width: 22px;
  height: 22px;
  margin-right: 8px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
  font-weight: 800;
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 1px 1px rgba(0, 0, 0, 0.35);
}

.face.a { background: radial-gradient(circle at 35% 30%, #c6ef86, #62b418 58%, #3d7a0c); }
.face.b { background: radial-gradient(circle at 35% 30%, #ff9d9d, #e23d3d 58%, #9d1414); }

.library, .studio, .social, .support, .detail {
  height: 100%;
  display: grid;
  gap: 14px;
}

.library {
  grid-template-rows: 1fr 118px;
}

.library-stage, .detail {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 14px;
  min-height: 0;
}

.art-frame {
  min-height: 0;
  background: #111 center / cover no-repeat;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
  border: 3px solid transparent;
}

.library-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.thumb {
  position: relative;
  border: 3px solid transparent;
  padding: 0;
  background: #111 center / cover no-repeat;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
  color: #fff;
}

.thumb span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 16px 8px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}

.window,
.textbox-dark,
.textbox-light,
.input-message,
.progress-bar {
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.textbox-dark,
.textbox-light {
  height: auto;
  min-height: 0;
}

.library-stage > .window,
.detail > .window,
.support > .window {
  height: 100%;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}

.library-stage > .window .window-content,
.detail > .window .window-content,
.support > .window .window-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.window-content .btn-long,
.window-content .btn-short {
  position: static;
  margin-right: 8px;
}

.window-content .btn-long {
  width: 100%;
  background: linear-gradient(180deg, rgba(230, 230, 230, 1) 0%, rgba(212, 212, 212, 1) 90%);
  color: #525252;
  text-align: left;
}

.window-content .btn-long:hover,
.window-content .btn-long.active {
  background: linear-gradient(0deg, rgba(115, 143, 50, 1) 0%, rgba(142, 219, 70, 1) 100%);
  color: #fff;
}

.window-content .textbox-dark,
.window-content .textbox-dark p { color: #fff; }

.window-content p.meta { color: #3d6d12; }
.window-content p.fine { color: #444; }

a.btn-long,
a.btn-short { text-decoration: none; }

.window-content p + p { margin-top: 8px; }

.meta {
  color: #3d6d12;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.studio {
  height: auto;
  align-content: start;
  grid-template-columns: 1.15fr 0.85fr;
  grid-template-rows: auto auto;
}

.stats {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stats .textbox-dark,
.pillars .textbox-dark,
.pillars .textbox-light,
.faq-answer { margin-bottom: 0; }

.stats .textbox-dark strong { font-size: 20px; }

.pillars { display: grid; gap: 10px; }

.social {
  height: 100%;
  align-content: stretch;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 300px);
}

.chat-wrapper {
  min-height: 0;
  height: 100%;
  background: #1e1f22;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.28);
}

.chat-wrapper iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.social > .window {
  height: 100%;
  margin-bottom: 0;
}

.support {
  grid-template-columns: 0.9fr 1.1fr;
}

.rows .btn-long { width: 100%; margin-bottom: 8px; }

.field {
  display: block;
  margin: 8px 0 4px;
  font-size: 13px;
  color: #525252;
}

.input-field,
select.input-field,
textarea.input-field {
  width: 100%;
  display: block;
  margin-bottom: 8px;
  user-select: text;
  background: #fff;
}

textarea.input-field { min-height: 88px; resize: vertical; }

.char-count { text-align: right; font-size: 11px; color: #555; }

.checkbox-wrapper { display: flex; align-items: center; margin: 8px 0 12px; }

#recaptcha-container { margin: 8px 0 12px; min-height: 78px; }

.modal-back {
  position: absolute;
  inset: 0;
  background: rgba(30, 30, 30, 0.28);
  display: grid;
  place-items: center;
  z-index: 4;
  padding: 20px;
}

.modal-back .window { width: min(460px, 100%); height: auto; }

.fine {
  margin-top: 14px;
  font-size: 12px;
  color: #444;
}

.fine a { color: #24580c; }

.legal-shell {
  height: auto;
  min-height: 100dvh;
  user-select: text;
}

.legal-shell .top { justify-content: flex-start; }

.legal-shell .channel { text-decoration: none; }

.legal-shell .stage {
  display: flex;
  flex-direction: column;
}

.legal-shell .window {
  height: auto;
  padding-bottom: 0;
}

.legal-shell .window-content h2 {
  margin: 18px 0 2px;
  padding: 0 5px;
  font-size: 13px;
  font-weight: 700;
  color: #3d6d12;
}

.legal-shell .window-content h2:first-child { margin-top: 4px; }

.legal-shell .window-content h3 {
  margin: 10px 0 0;
  padding: 0 5px;
  font-size: 13px;
  font-weight: 700;
  color: #525252;
}

.legal-shell .window-content a { color: #24580c; }

.legal-shell .window-content .btn-long { margin-top: 12px; }

@media (max-width: 980px) {
  .shell { padding: 14px 16px 10px; height: auto; min-height: 100dvh; }
  body { overflow: auto; }
  .top { height: auto; align-items: center; justify-content: space-between; flex-wrap: wrap; }
  .sound-toggle { position: static; width: 100%; margin-bottom: 8px; }
  .profile { position: static; margin-left: 12px; }
  .channels { gap: 12px 16px; overflow: visible; flex-wrap: wrap; width: auto; flex: 1; justify-content: flex-start; }
  .channel { font-size: 16px; flex: none; }
  .channel.active { font-size: 20px; }
  .profile-text { display: none; }
  .home-grid {
    height: auto;
    grid-template-columns: 1fr;
    grid-template-rows: none;
  }
  .home-grid .tile { min-height: 140px; grid-column: 1 / -1; }
  .tile.hero, .span-2 { grid-column: 1 / -1; }
  .tile.hero { grid-row: auto; min-height: 210px; }
  .library, .library-stage, .detail, .studio, .social, .support {
    height: auto;
    grid-template-columns: 1fr;
  }
  .art-frame { min-height: 220px; }
  .chat-wrapper { min-height: 480px; }
  .library-row { grid-template-columns: repeat(3, 1fr); height: 92px; }
  .stats { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; }
}

/* Development tab (patch notes) */
.development {
  height: 100%;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
}
.development > .window {
  height: 100%;
  min-height: 0;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
}
.development > .window .window-content { flex: 1; min-height: 0; overflow: auto; }
.development .rows { margin-top: 12px; }
.window-content .btn-long.dev-filter { border-left: 6px solid var(--accent, #62b418); }
.patch {
  border-left: 6px solid var(--accent);
  background: linear-gradient(180deg, #f4f4f4 0%, #e4e4e4 100%);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  padding: 10px 14px 12px;
  margin-bottom: 12px;
  color: #333;
}
.patch-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.patch-game {
  width: 100%;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.patch h3 { margin: 0; font-size: 16px; font-weight: 700; color: #222; flex: 1; }
.patch time { font-size: 12px; font-weight: 600; color: #666; }
.patch ul { margin: 8px 0 0; padding-left: 20px; }
.patch li { font-size: 14px; line-height: 1.45; margin: 2px 0; }
@media (max-width: 980px) {
  .development { height: auto; grid-template-columns: 1fr; }
  .development > .window { height: auto; }
  .development > .window .window-content { overflow: visible; }
  .patch h3 { font-size: 15px; }
}

/* ---- Phone layout (added 2026-11-04). Desktop (>768px) is untouched. ---- */
@media (max-width: 768px) {
  body { -webkit-text-size-adjust: 100%; }
  .shell { padding: 10px 12px calc(8px + env(safe-area-inset-bottom)); user-select: auto; }
  .top { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; }
  .sound-toggle { grid-column: 1; grid-row: 1; width: auto; margin: 0; min-height: 44px; }
  .profile { grid-column: 2; grid-row: 1; margin: 0; min-height: 44px; }
  .profile img { width: 40px; height: 40px; }
  /* One swipeable row of channels instead of two wrapped lines */
  .channels {
    grid-column: 1 / -1; grid-row: 2;
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    gap: 4px; padding: 0 2px 2px; margin: 0 -12px; padding-left: 12px; padding-right: 12px;
    scroll-snap-type: x proximity; scrollbar-width: none; -webkit-overflow-scrolling: touch;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent);
            mask-image: linear-gradient(90deg, transparent 0, #000 12px, #000 calc(100% - 24px), transparent);
  }
  .channels::-webkit-scrollbar { display: none; }
  .channel { min-height: 44px; padding: 10px 10px; font-size: 18px; scroll-snap-align: center; }
  .channel.active { font-size: 22px; }
  .stage { margin-top: 6px; }
  /* Home: two-column tile grid keeps the dashboard feel and halves scrolling */
  .home-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .home-grid .tile { min-height: 120px; grid-column: auto; }
  .home-grid .tile.hero, .home-grid .span-2 { grid-column: 1 / -1; }
  .home-grid .tile.hero { min-height: 190px; }
  .home-grid .logo-tile, .home-grid .tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .home-grid .logo-tile { min-height: 150px; background-size: auto 190%; background-position: center 45%; }
  .tile.system .label { font-size: 16px; }
  .tile:hover:not(.is-focused) { border-color: transparent; }
  /* Games: thumbnails become a swipeable strip that never overlaps the info box */
  .library { grid-template-rows: none; }
  .art-frame { min-height: 0; aspect-ratio: 16 / 9; }
  .library-row {
    display: flex; height: auto; gap: 8px; overflow-x: auto;
    margin: 0 -12px; padding: 2px 12px 6px; scroll-snap-type: x mandatory; scrollbar-width: none;
  }
  .library-row::-webkit-scrollbar { display: none; }
  .thumb { flex: 0 0 42%; aspect-ratio: 16 / 10; scroll-snap-align: start; }
  .thumb span { font-size: 13px; }
  /* Bigger, easier buttons and readable text */
  .window-content p, .window-content li { font-size: 15px; line-height: 1.5; }
  .window-content .btn-short { min-height: 44px; padding: 0 18px; }
  .btn-long, .window-content .btn-long { min-height: 48px; display: flex; align-items: center; height: auto; }
  .rows .btn-long { white-space: normal; padding-top: 10px; padding-bottom: 10px; line-height: 1.3; }
  .input-field, select.input-field, textarea.input-field { font-size: 16px; min-height: 44px; }
  .fine, .fine a { font-size: 13px; }
  .fine a { display: inline-block; padding: 12px 0; }
  .social .chat-wrapper { min-height: 0; height: 62vh; max-height: 520px; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .stats .textbox-dark strong { font-size: 16px; }
  /* Development: game filters as a compact row of chips */
  .development .rows { display: flex; flex-wrap: wrap; gap: 6px; }
  .development .rows .btn-long { width: auto; flex: 1 1 auto; margin: 0; }
  .patch li { font-size: 15px; }
  /* No controller hints on phones: tabs + in-page Back/Close buttons handle navigation */
  .hintbar { display: none; }
  .modal-back { position: fixed; padding: 16px; }
}
@media (max-width: 480px) {
  .sound-toggle .checkbox-label { font-size: 13px; }
  .stats { gap: 6px; }
  .stats .textbox-dark p { font-size: 13px; }
  .stats .textbox-dark strong { font-size: 15px; }
}
