:root {
  --bg: #f6f3ff;
  --paper: #ffffff;
  --wash: #ebe4ff;
  --cyanwash: #dffbff;
  --navy: #150966;
  --purple: #5618fb;
  --cyan: #01ddfc;
  --muted: #5c5688;
  --line: #d8d0f0;
  font-family: Inter, system-ui, sans-serif;
  color: var(--navy);
  background: #ebe6fb;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
}

.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 420px;
  margin: 0 auto;
  background: var(--bg);
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  padding: 0 12px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

.brand,
.actions,
.icon-btn {
  display: flex;
  align-items: center;
}

.brand {
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.brand img {
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.actions {
  gap: 6px;
}

.icon-btn {
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: var(--wash);
  color: var(--navy);
  cursor: pointer;
}

.icon-btn[aria-pressed="true"] {
  background: var(--navy);
  color: #fff;
}

.icon-btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.update-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
}

.update-banner[hidden] {
  display: none;
}

.update-banner button {
  flex-shrink: 0;
  border: 0;
  border-radius: 10px;
  padding: 6px 10px;
  background: #fff;
  color: var(--navy);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.stage {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px;
}

.stage-game {
  padding: 0;
  touch-action: none;
}

.stage-game .game-frame {
  flex: 1;
  touch-action: none;
}

.status {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 16px;
  font-size: 11px;
}

.status strong {
  color: var(--purple);
  font-weight: 700;
}

.status span {
  color: var(--muted);
}

.section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 0;
  margin: 0 0 18px;
  list-style: none;
}

.game {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  color: inherit;
  text-decoration: none;
}

.game:hover {
  border-color: var(--purple);
}

.game.is-soon {
  cursor: default;
  opacity: 0.62;
}

.game.is-soon:hover {
  border-color: var(--line);
}

.thumb {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  color: #fff;
  flex-shrink: 0;
}

.thumb-purple {
  background: var(--purple);
}

.thumb-green {
  background: #4a752c;
  overflow: hidden;
}

.thumb-navy {
  background: var(--navy);
}

.thumb-gray {
  background: #c0c0c0;
  overflow: hidden;
}

.thumb-cyan {
  background: var(--cyan);
  color: var(--navy);
}

.thumb-orange {
  background: #f67c5f;
  overflow: hidden;
}

.thumb-rose {
  background: #c44536;
  overflow: hidden;
}

.thumb-amber {
  background: #e0a100;
  overflow: hidden;
}

.thumb-pink {
  background: #e85d8e;
  overflow: hidden;
}

.thumb-teal {
  background: #0d9488;
  overflow: hidden;
}

.thumb img {
  display: block;
  width: 100%;
  height: 100%;
}

.game h2 {
  margin: 0 0 4px;
  font-size: 15px;
}

.game p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.tag {
  margin-left: auto;
  padding: 5px 9px;
  border-radius: 99px;
  background: var(--cyanwash);
  color: var(--navy);
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.empty {
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 18px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.game-frame {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.game-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 16px 16px 8px;
}

.score,
.best {
  flex: 1;
  padding: 12px;
  border-radius: 16px;
  background: var(--paper);
}

.best {
  background: var(--cyanwash);
}

.score small,
.best small {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.score strong,
.best strong {
  font-size: 24px;
}

.best strong {
  color: var(--purple);
}

.theme-orange .score,
.theme-orange .best {
  background: #bbada0;
  color: #f9f6f2;
}

.theme-orange .best {
  background: #8f7a66;
}

.theme-orange .score small,
.theme-orange .best small {
  color: #eee4da;
}

.theme-orange .score strong,
.theme-orange .best strong {
  color: #f9f6f2;
}

.new-game {
  align-self: stretch;
  margin: 16px 16px 24px;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.theme-orange .new-game {
  background: #8f7a66;
}

.theme-navy .score,
.theme-navy .best {
  background: #150966;
  color: #fff;
}

.theme-navy .best {
  background: #5618fb;
}

.theme-navy .score small,
.theme-navy .best small {
  color: #01ddfc;
}

.theme-navy .new-game {
  background: #150966;
}

.theme-gray .score,
.theme-gray .best {
  background: #000;
  color: #ff0000;
  border-radius: 4px;
  font-family: "Courier New", ui-monospace, monospace;
}

.theme-gray .best {
  background: #111;
}

.theme-gray .score small,
.theme-gray .best small {
  color: #ff6666;
}

.theme-gray .score strong,
.theme-gray .best strong {
  color: #ff0000;
}

.theme-gray .new-game {
  background: #c0c0c0;
  color: #000;
  border: 2px solid;
  border-color: #fff #808080 #808080 #fff;
}

.theme-cyan .score,
.theme-cyan .best {
  background: #150966;
  color: #fff;
}

.theme-cyan .best {
  background: #0a7f92;
}

.theme-cyan .score small,
.theme-cyan .best small {
  color: #01ddfc;
}

.theme-cyan .new-game {
  background: #0a7f92;
}

.theme-purple .score,
.theme-purple .best {
  background: #5618fb;
  color: #fff;
}

.theme-purple .best {
  background: #150966;
}

.theme-purple .score small,
.theme-purple .best small {
  color: #d8d0f0;
}

.theme-purple .new-game {
  background: #5618fb;
}

.theme-green .score,
.theme-green .best {
  background: #4a752c;
  color: #fff;
}

.theme-green .best {
  background: #2d5016;
}

.theme-green .score small,
.theme-green .best small {
  color: #d4e8a8;
}

.theme-green .score strong,
.theme-green .best strong {
  color: #fff;
}

.theme-green .new-game {
  background: #4a752c;
}

.theme-rose .score,
.theme-rose .best {
  background: #c44536;
  color: #fff;
}

.theme-rose .best {
  background: #7a1f18;
}

.theme-rose .score small,
.theme-rose .best small {
  color: #ffd4cc;
}

.theme-rose .score strong,
.theme-rose .best strong {
  color: #fff;
}

.theme-rose .new-game {
  background: #c44536;
}

.theme-amber .score,
.theme-amber .best {
  background: #1c1c1c;
  color: #fff;
}

.theme-amber .best {
  background: #262626;
}

.theme-amber .score small,
.theme-amber .best small {
  color: #8a8a8a;
}

.theme-amber .score strong,
.theme-amber .best strong {
  color: #fff;
}

.theme-amber .new-game {
  background: #3ec6e8;
  color: #102026;
}

.theme-pink .score,
.theme-pink .best {
  background: #e85d8e;
  color: #fff;
}

.theme-pink .best {
  background: #9b2d5b;
}

.theme-pink .score small,
.theme-pink .best small {
  color: #ffd0e2;
}

.theme-pink .score strong,
.theme-pink .best strong {
  color: #fff;
}

.theme-pink .new-game {
  background: #e85d8e;
}

.theme-teal .score,
.theme-teal .best {
  background: #0d9488;
  color: #fff;
}

.theme-teal .best {
  background: #115e59;
}

.theme-teal .score small,
.theme-teal .best small {
  color: #b7efe8;
}

.theme-teal .score strong,
.theme-teal .best strong {
  color: #fff;
}

.theme-teal .new-game {
  background: #0d9488;
}

.mount {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 280px;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 20px;
  background: var(--paper);
  text-align: center;
}

.mount.has-game {
  flex: none;
  min-height: 0;
  padding: 8px 16px 0;
  border: 0;
  background: transparent;
  align-items: stretch;
}

.mount.has-game iframe {
  display: block;
  flex: none;
  width: 100%;
  height: 300px;
  border: 0;
  background: transparent;
}

.mount p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.mount strong {
  font-size: 16px;
}

.hint {
  margin: 20px 16px 0;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.settings {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.card {
  overflow: hidden;
  border-radius: 18px;
  background: var(--paper);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 50px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
}

.row:last-child {
  border-bottom: 0;
}

.row-action {
  width: 100%;
  border: 0;
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  text-align: left;
  cursor: pointer;
}

.row-action[aria-pressed="true"] {
  background: var(--wash);
}

.row span {
  color: var(--muted);
  font-weight: 600;
}

.row-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  color: inherit;
}

.row-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgb(21 9 102 / 36%);
}

.sheet[hidden] {
  display: none;
}

.sheet-card {
  width: min(100%, 320px);
  padding: 16px;
  border-radius: 18px;
  background: var(--paper);
}

.sheet-card strong {
  display: block;
  font-size: 15px;
}

.sheet-card p {
  margin: 8px 0 16px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.sheet-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.sheet-actions button {
  border: 0;
  border-radius: 10px;
  padding: 8px 12px;
  background: var(--wash);
  color: var(--navy);
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

#confirm-yes {
  background: var(--navy);
  color: #fff;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 21;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.toast[hidden] {
  display: none;
}

.toggle {
  width: 40px;
  height: 22px;
  padding: 3px;
  border: 0;
  border-radius: 99px;
  background: var(--line);
  cursor: pointer;
}

.toggle[aria-pressed="true"] {
  background: var(--purple);
}

.toggle i {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 99px;
  background: #fff;
  margin-left: 0;
}

.toggle[aria-pressed="true"] i {
  margin-left: auto;
}
