*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; color-scheme: dark; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: #0b0c0f;
  color: #f3f4f6;
  min-height: 100vh;
  line-height: 1.4;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select { font: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 20px;
  background: #111318;
  border-bottom: 1px solid #222630;
}
.logo {
  display: inline-flex; align-items: center;
  font-weight: 900; font-size: 24px; letter-spacing: -0.7px;
  color: #ffffff; text-decoration: none; user-select: none; flex-shrink: 0;
}
.logo span {
  display: inline-block;
  background: #ff9000;
  color: #0b0c0f;
  padding: 2px 7px;
  margin-left: 3px;
  border-radius: 5px;
  font-weight: 900;
  letter-spacing: -0.5px;
}
.topbar h1 {
  font-size: 16px; font-weight: 700; color: #d1d5db;
  margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.search-wrap {
  position: relative; flex: 1; max-width: 440px; margin: 0 auto;
}
.search {
  width: 100%; height: 38px;
  padding: 0 38px 0 36px;
  border-radius: 8px;
  border: 1px solid #282d3a;
  background: #181b22;
  color: #f9fafb;
  font-size: 14px;
  outline: none;
  transition: border-color .15s, background .15s;
}
.search::placeholder { color: #8b93a3; }
.search:focus { border-color: #ff9000; background: #1d212a; }
.search-ico {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: #8b93a3; pointer-events: none;
}
.search-key {
  position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  font-size: 11px; font-weight: 700; color: #9ca3af;
  background: #232732; border: 1px solid #323846;
  border-radius: 4px; padding: 1px 6px; pointer-events: none;
}

.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.stat-pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 36px; padding: 0 12px;
  background: #171a21; border: 1px solid #262b36; border-radius: 8px;
  font-size: 13px; font-weight: 700; color: #e5e7eb;
}
.stat-pill b { color: #ff9000; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px;
  border-radius: 7px; border: 1px solid #2b303d;
  background: #1b1f28; color: #f3f4f6;
  font-weight: 700; font-size: 13px;
  cursor: pointer; user-select: none; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .08s;
}
.btn:hover { background: #252a36; border-color: #3d4456; }
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: #ff9000; color: #0b0c0f; border-color: #ff9000; font-weight: 800;
}
.btn-primary:hover { background: #ffa326; border-color: #ffa326; }
.btn.on { background: #262015; border-color: #ff9000; color: #ff9000; }

.app-shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 60px);
}
.sidebar {
  background: #111318;
  border-right: 1px solid #222630;
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 4px;
  position: sticky; top: 60px; height: calc(100vh - 60px); overflow-y: auto;
}
.side-label {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.8px;
  color: #8b93a3; padding: 10px 10px 4px;
}
.side-btn {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 9px 11px;
  border: 0; border-radius: 7px;
  background: transparent; color: #d1d5db;
  font-size: 14px; font-weight: 600; text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
.side-btn:hover { background: #1a1d25; color: #fff; }
.side-btn.active {
  background: #1f232d; color: #ff9000; font-weight: 700;
  box-shadow: inset 3px 0 0 #ff9000;
}
.side-cnt {
  font-size: 11px; font-weight: 700;
  background: #1c2029; color: #9ca3af;
  padding: 1px 7px; border-radius: 99px;
}
.side-btn.active .side-cnt { background: #ff9000; color: #0b0c0f; }

.side-box {
  margin-top: auto; padding: 12px;
  background: #171a21; border: 1px solid #252a35; border-radius: 9px;
}
.side-box-title { font-size: 12px; font-weight: 800; color: #f3f4f6; margin-bottom: 4px; }
.side-box-sub { font-size: 11px; color: #9ca3af; margin-bottom: 10px; }
.side-box .btn { width: 100%; }

.main-area { padding: 20px 24px 40px; max-width: 1440px; width: 100%; margin: 0 auto; }

.bento {
  display: grid;
  grid-template-columns: 1.55fr 1fr 1fr;
  grid-auto-rows: 148px;
  gap: 14px;
  margin-bottom: 26px;
}
.bento-main {
  grid-row: span 2;
  position: relative; border-radius: 12px; overflow: hidden;
  background: #161920; border: 1px solid #2b303c;
  display: flex; align-items: flex-end;
  transition: border-color .15s, transform .15s;
}
.bento-main:hover { border-color: #ff9000; transform: translateY(-2px); }
.bento-main img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  transition: transform .3s ease;
}
.bento-main:hover img { transform: scale(1.03); }
.bento-shade {
  position: relative; z-index: 2; width: 100%;
  padding: 20px;
  background: linear-gradient(0deg, rgba(11,12,15,0.96) 0%, rgba(11,12,15,0.72) 60%, transparent 100%);
  display: flex; align-items: flex-end; justify-content: space-between; gap: 14px;
}
.badge {
  display: inline-block; font-size: 11px; font-weight: 900; text-transform: uppercase;
  letter-spacing: 0.5px; padding: 3px 8px; border-radius: 4px;
  background: #ff9000; color: #0b0c0f; margin-bottom: 6px;
}
.bento-main h2 { font-size: 24px; font-weight: 900; margin: 0 0 4px; letter-spacing: -0.4px; }
.bento-main p { font-size: 13px; color: #d1d5db; margin: 0; max-width: 420px; }

.bento-mini {
  position: relative; border-radius: 10px; overflow: hidden;
  background: #161920; border: 1px solid #262b36;
  transition: border-color .15s, transform .15s;
}
.bento-mini:hover { border-color: #ff9000; transform: translateY(-2px); }
.bento-mini img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.bento-mini:hover img { transform: scale(1.04); }
.bento-mini-bar {
  position: absolute; inset: auto 0 0 0; padding: 8px 10px;
  background: linear-gradient(0deg, rgba(11,12,15,0.95) 0%, rgba(11,12,15,0.5) 75%, transparent 100%);
  display: flex; align-items: center; justify-content: space-between;
}
.bento-mini-bar span { font-size: 13px; font-weight: 800; }
.bento-mini-bar small { font-size: 11px; color: #ff9000; font-weight: 700; }

.sec-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  margin-bottom: 14px;
}
.sec-title {
  font-size: 18px; font-weight: 800; margin: 0; letter-spacing: -0.3px;
  display: flex; align-items: center; gap: 8px;
}
.sec-title::before {
  content: ""; display: inline-block; width: 4px; height: 18px;
  background: #ff9000; border-radius: 2px;
}
.sort-select {
  height: 34px; padding: 0 10px; border-radius: 7px;
  background: #171a21; border: 1px solid #282d3a; color: #e5e7eb;
  font-size: 13px; font-weight: 600; outline: none; cursor: pointer;
}
.sort-select:focus { border-color: #ff9000; }

.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.chip {
  height: 32px; padding: 0 12px; border-radius: 6px;
  border: 1px solid #262b36; background: #161920;
  color: #9ca3af; font-weight: 700; font-size: 13px; cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.chip:hover { color: #fff; background: #1e222c; }
.chip.active { background: #ff9000; color: #0b0c0f; border-color: #ff9000; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 14px;
}
.tile {
  position: relative; display: flex; flex-direction: column;
  border-radius: 10px; overflow: hidden;
  background: #161920; border: 1px solid #242934;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-3px);
  border-color: #ff9000;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  outline: none;
}
.tile-thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #0e1015; }
.tile-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s ease; }
.tile:hover .tile-thumb img { transform: scale(1.05); }
.tile-play {
  position: absolute; inset: 0;
  background: rgba(11, 12, 15, 0.45);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .15s ease;
}
.tile:hover .tile-play { opacity: 1; }
.tile-play span {
  background: #ff9000; color: #0b0c0f; font-weight: 900; font-size: 12px;
  padding: 6px 12px; border-radius: 6px; letter-spacing: 0.3px;
}

.tile .best {
  position: absolute; top: 7px; left: 7px; z-index: 2;
  font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 5px;
  background: rgba(11, 12, 15, 0.88); border: 1px solid #22c55e; color: #4ade80;
}
.tile .tag-badge {
  position: absolute; top: 7px; left: 7px; z-index: 2;
  font-size: 10px; font-weight: 900; text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 6px; border-radius: 4px;
}
.tag-hot { background: #ff9000; color: #0b0c0f; }
.tag-new { background: #22c55e; color: #052e16; }

.fav-btn {
  position: absolute; top: 6px; right: 6px; z-index: 3;
  width: 28px; height: 28px; border-radius: 6px; border: 1px solid rgba(255,255,255,0.12);
  background: rgba(11, 12, 15, 0.78); color: #9ca3af;
  font-size: 14px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.fav-btn:hover { color: #fff; background: #1f242f; }
.fav-btn.on { color: #ff9000; border-color: #ff9000; }

.tile .meta {
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.tile .name { font-weight: 800; font-size: 14px; color: #f9fafb; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: #9ca3af;
}
.tile-rate { color: #22c55e; font-weight: 700; }

.empty {
  text-align: center; color: #9ca3af; padding: 48px 20px;
  background: #14171e; border: 1px dashed #2a2f3d; border-radius: 10px;
}

footer {
  border-top: 1px solid #1e222b;
  color: #8b93a3; font-size: 12px;
  padding: 24px; text-align: center;
  background: #0e1014;
}

.game-wrap { max-width: 1020px; margin: 0 auto; padding: 18px 16px 40px; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 700; color: #9ca3af;
  margin: 2px 0 12px; transition: color .12s;
}
.crumb:hover { color: #ff9000; }
.stage {
  position: relative; width: 100%;
  border-radius: 10px 10px 0 0; overflow: hidden;
  border: 1px solid #282d3a; border-bottom: 0;
  background: #050608;
}
.stage:fullscreen { display: flex; align-items: center; justify-content: center; border: 0; border-radius: 0; }
.stage canvas { display: block; width: 100%; height: auto; max-height: 82vh; object-fit: contain; touch-action: none; user-select: none; -webkit-user-select: none; }

.theater-bar {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 10px 14px;
  background: #151820;
  border: 1px solid #282d3a;
  border-radius: 0 0 10px 10px;
  margin-bottom: 12px;
}
.theater-info { display: flex; align-items: center; gap: 10px; }
.theater-thumb { width: 48px; height: 30px; border-radius: 5px; object-fit: cover; border: 1px solid #2e3442; }
.theater-title { font-weight: 800; font-size: 15px; color: #fff; }
.theater-cat { font-size: 12px; color: #9ca3af; }
.theater-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.help {
  color: #9ca3af; font-size: 13px; text-align: center;
  margin: 10px 0 0; padding: 10px 14px;
  background: #14171e; border: 1px solid #222631; border-radius: 8px;
}
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.pads { display: flex; gap: 8px; justify-content: center; margin-top: 10px; }
.pad {
  width: 68px; height: 52px; font-size: 22px; font-weight: 900;
  border-radius: 8px; border: 2px solid #2e3444; background: #161922; color: #fff;
  cursor: pointer; touch-action: none;
}
.pad-0 { border-color: #ef4444; }
.pad-1 { border-color: #38bdf8; }
.pad-2 { border-color: #22c55e; }
.pad-3 { border-color: #ff9000; }

.more-sec { margin-top: 28px; }

.panel {
  background: #14171f; border: 1px solid #282d3a;
  border-radius: 10px 10px 0 0; border-bottom: 0; padding: 20px;
}
.stats { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-weight: 800; margin-bottom: 12px; }
.stats span { background: #1d212c; border: 1px solid #2c3242; padding: 6px 12px; border-radius: 6px; font-size: 13px; }
.question { font-size: clamp(18px, 2.6vw, 24px); font-weight: 800; margin: 8px 0 16px; text-align: center; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.answer {
  padding: 14px; font-size: 16px; font-weight: 700;
  border-radius: 8px; border: 1px solid #2e3444; background: #1b1f2a; color: #fff; cursor: pointer;
}
.answer:hover:not(:disabled) { border-color: #ff9000; background: #232836; }
.answer.right { background: #14532d; border-color: #22c55e; }
.answer.wrong { background: #7f1d1d; border-color: #ef4444; }
.timerbar {
  display: block; width: 100%; height: 8px; border-radius: 4px;
  background: #232733; overflow: hidden; margin-bottom: 14px; border: 0; accent-color: #ff9000;
}
.timerbar::-webkit-progress-bar { background: #232733; border-radius: 4px; }
.timerbar::-webkit-progress-value { background: #ff9000; border-radius: 4px; }
.timerbar::-moz-progress-bar { background: #ff9000; border-radius: 4px; }
.quiz-host { display: flex; justify-content: center; margin-bottom: 6px; }
.quiz-host img { height: 120px; width: auto; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 520px; margin: 0 auto; }
.card {
  aspect-ratio: 3 / 4; border-radius: 8px; border: 2px solid #2e3444; cursor: pointer; padding: 0;
  background: #ff9000; display: flex; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 900; color: #0b0c0f;
}
.card img { width: 86%; height: 86%; object-fit: contain; display: none; }
.card.flip, .card.done { background: #1d212c; border-color: #3b4254; }
.card.flip img, .card.done img { display: block; }
.card.flip span, .card.done span { display: none; }
.card.done { border-color: #22c55e; opacity: .8; cursor: default; }

.notfound { text-align: center; padding: 60px 20px; }
.notfound img { margin: 0 auto 14px; height: 180px; width: auto; }

.asn-badge {
  position: fixed; right: 14px; bottom: 14px; z-index: 2147483647;
  display: inline-flex; align-items: center; gap: 8px;
  height: 36px; padding: 0 13px; border-radius: 999px;
  border: 1px solid #2b303d; background: #15181f; color: #cbd2dc;
  font-size: 12px; font-weight: 800; letter-spacing: .2px;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .55);
  transition: border-color .15s, background .15s, color .15s, transform .08s;
}
.asn-badge:hover { transform: translateY(-1px); }
.asn-badge:active { transform: translateY(0); }
.asn-badge:focus-visible { outline: 2px solid #ff9000; outline-offset: 2px; }
.asn-ico { width: 16px; height: 16px; flex: 0 0 auto; }
.asn-state { margin-left: 1px; }
.asn-on { color: #4ade80; border-color: #1f4d2e; background: #0f1a13; }
.asn-on:hover { border-color: #22c55e; }
.asn-on .asn-slash { display: none; }
.asn-off { color: #9ca3af; border-color: #3a2230; background: #191219; }
.asn-off:hover { border-color: #7f1d1d; }
.asn-off .asn-mark { display: none; }
.asn-off .asn-state { color: #f87171; }

@media (max-width: 960px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static; height: auto; flex-direction: row; overflow-x: auto;
    border-right: 0; border-bottom: 1px solid #222630; padding: 8px 12px;
  }
  .side-label, .side-box { display: none; }
  .side-btn { width: auto; white-space: nowrap; gap: 6px; padding: 6px 10px; }
  .side-btn.active { box-shadow: none; background: #ff9000; color: #0b0c0f; }
  .bento { grid-template-columns: 1fr 1fr; grid-auto-rows: 140px; }
  .bento-main { grid-column: span 2; min-height: 220px; }
}
@media (max-width: 640px) {
  .bento { grid-template-columns: 1fr; }
  .bento-main { grid-column: span 1; }
  .answers { grid-template-columns: 1fr; }
  .stat-pill { display: none; }
  .pad { width: 56px; height: 46px; font-size: 18px; }
  .pads { gap: 6px; }
  .cards { gap: 7px; }
  .asn-badge { height: 32px; padding: 0 10px; font-size: 11px; right: 10px; bottom: 10px; }
}
