/* Porandy start-menu visual system. Game canvas/modal styles remain in play.html. */
:root {
  --porandy-blue: #174f9b;
  --porandy-blue-deep: #123d78;
  --porandy-sky: #67c8f4;
  --porandy-yellow: #ffd633;
  --porandy-red: #ef4b45;
  --porandy-ink: #17345f;
  --porandy-muted: #5d7698;
  --porandy-card: rgba(255, 255, 255, 0.91);
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

#start-overlay {
  overflow: auto;
  align-items: center;
  padding: clamp(14px, 3vw, 32px);
  touch-action: pan-y;
  overscroll-behavior: contain;
  background:
    linear-gradient(180deg, rgba(220, 248, 255, 0.16), rgba(37, 133, 80, 0.18)),
    url('./porandy-menu-bg.svg') center / cover no-repeat;
}

#start-overlay::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 5%, rgba(255,255,255,.48), transparent 30%),
    linear-gradient(90deg, rgba(20,75,132,.08), transparent 30%, transparent 70%, rgba(20,75,132,.08));
}

.start-panel {
  isolation: isolate;
  width: min(1080px, 100%);
  max-width: none;
  display: grid;
  grid-template-columns: minmax(220px, .82fr) minmax(275px, 1fr) minmax(275px, 1fr);
  align-items: stretch;
  gap: 18px;
  padding: 20px;
  overflow: visible;
  text-align: left;
  color: var(--porandy-ink);
  border: 4px solid rgba(255,255,255,.84);
  border-radius: 30px;
  background: rgba(234, 249, 255, .68);
  box-shadow: 0 18px 0 rgba(21,79,145,.18), 0 28px 70px rgba(25,70,112,.26);
  backdrop-filter: blur(14px) saturate(1.12);
  -webkit-backdrop-filter: blur(14px) saturate(1.12);
}

.start-panel::before {
  inset: 0;
  width: auto;
  height: auto;
  border-radius: 25px;
  opacity: .5;
  background: radial-gradient(circle at 9% 12%, rgba(255,255,255,.9), transparent 28%);
  animation: none;
  z-index: -1;
}

.start-brand,
.start-account-card,
.start-progress-card {
  position: relative;
  min-width: 0;
  padding: 20px;
  border: 2px solid rgba(38,100,168,.15);
  border-radius: 22px;
  background: var(--porandy-card);
  box-shadow: 0 8px 24px rgba(26,83,139,.14), inset 0 1px 0 #fff;
}

.start-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 25%, rgba(255,231,90,.3), transparent 38%),
    linear-gradient(155deg, rgba(255,255,255,.96), rgba(214,243,255,.92));
}

.start-brand::after {
  content: '';
  position: absolute;
  width: 150px;
  height: 150px;
  right: -70px;
  bottom: -78px;
  border: 18px solid rgba(23,79,155,.06);
  border-radius: 50%;
}

.start-logo-image {
  display: block;
  width: min(100%, 260px);
  height: auto;
  filter: drop-shadow(0 7px 8px rgba(34,81,135,.18));
}

.start-tagline {
  margin: 10px 0 16px;
  color: var(--porandy-muted);
  font-size: 13px;
  font-weight: 800;
  line-height: 1.55;
}

.brand-chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
}
.brand-chips span {
  padding: 5px 8px;
  color: var(--porandy-blue);
  background: rgba(40,129,200,.09);
  border: 1px solid rgba(40,129,200,.15);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
}

.section-kicker {
  margin-bottom: 10px;
  color: var(--porandy-blue);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 1.8px;
}

.sync-status {
  min-height: 36px;
  margin: 0 0 11px;
  padding: 8px 10px;
  color: #466987;
  border-color: rgba(37,103,166,.18);
  background: #edf8fd;
  font-size: 11px;
}
.sync-status[data-state="ready"] { color: #14734e; border-color: #a8dfc5; background: #eafbf2; }
.sync-status[data-state="error"] { color: #a22d31; border-color: #f3b8b8; background: #fff0f0; }

.start-panel button {
  min-height: 44px;
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  box-shadow: 0 4px 0 rgba(20,60,105,.13);
}
.start-panel button:hover { transform: translateY(-1px); filter: brightness(1.035); }
.start-panel button:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(20,60,105,.16); }
.start-panel button:focus-visible,
.school-link:focus-visible { outline: 3px solid var(--porandy-yellow); outline-offset: 2px; }

.btn-play {
  color: #18345c;
  border: 2px solid #e8ae00 !important;
  background: linear-gradient(180deg, #ffe866, var(--porandy-yellow));
  box-shadow: 0 5px 0 #d9a600, 0 9px 20px rgba(216,168,0,.2) !important;
}
.btn-guest {
  color: #fff;
  border: 2px solid #0a4e8c !important;
  background: linear-gradient(180deg, #2577b8, #155b97);
  box-shadow: 0 5px 0 #165893, 0 9px 20px rgba(30,106,174,.18) !important;
}
.btn-google {
  color: #243f62;
  border: 2px solid #d7e3ee !important;
  background: #fff;
}
.btn-new-run {
  margin-top: 0;
  color: #45627d;
  border: 1px solid #b7ccdb;
  background: #eff7fb;
}
.btn-logout {
  min-height: 38px !important;
  color: #b23c43;
  border-color: #f1b7ba !important;
  background: #fff3f3;
  box-shadow: none !important;
}
.school-link { color: #42698f; }
.school-link:hover { color: var(--porandy-blue); }

.user-info {
  gap: 11px;
  margin-bottom: 10px;
  padding: 10px 12px;
  color: var(--porandy-ink);
  border-color: #d9e7f1;
  background: #f5fbff;
}
.user-info img { width: 38px; height: 38px; border-color: var(--porandy-yellow); }
.user-info .name { color: var(--porandy-ink); font-size: 14px; }
.user-info .status { color: var(--porandy-muted); }
.run-resume-card {
  margin: 8px 0;
  padding: 8px 10px;
  color: #1c6953;
  border-color: #9ed9c1;
  background: #edfdf5;
  font-size: 11px;
}
.run-resume-card strong { color: #157552; }

.stage-selector { gap: 8px; margin-bottom: 10px; }
.stage-btn {
  padding: 10px 8px !important;
  color: #56708c;
  border-color: #ccdbe6;
  background: #f4f8fb;
  box-shadow: 0 3px 0 #d8e4ec !important;
}
.stage-btn.active {
  color: #fff;
  border-color: #124b86;
  background: linear-gradient(160deg, #2169aa, #174f8c);
}
.stage-btn.active.s2 {
  color: #fff;
  border-color: #643684;
  background: linear-gradient(160deg, #8749a9, #6e3d95);
}
.stage-btn .stage-label { font-size: 9px; }
.stage-btn .stage-name { font-size: 12px; }

.btn-leaderboard {
  color: var(--porandy-blue);
  border: 1px solid #afcce0 !important;
  background: linear-gradient(180deg, #f8fdff, #e9f6fc);
}
.btn-leaderboard:hover { background: #fff; box-shadow: 0 5px 0 #b9d2e3 !important; }
.up-badge { margin-left: auto; color: #7b5100; font-weight: 950; }
.best-record {
  margin-top: 6px;
  padding: 11px 13px;
  color: #58718c;
  border-color: #edcc68;
  background: linear-gradient(135deg, #fff9d9, #edf8ff);
}
.best-record .wave { color: #e09500; }

.account-meta-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.account-meta-actions .btn-leaderboard { min-width: 0; padding-inline: 9px; }
.account-meta-actions .up-badge { font-size: 10px; }

/* Trainer dex and achievement progress */
.account-meta-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5200;
  align-items: center;
  justify-content: center;
  overflow-y: auto;
  padding: 18px;
  touch-action: pan-y;
  background: rgba(13, 43, 75, .68);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.account-meta-modal.open { display: flex; animation: fadeIn .2s ease-out; }
.account-meta-panel {
  width: min(1050px, 100%);
  max-height: min(92dvh, 850px);
  overflow: auto;
  padding: 22px;
  color: var(--porandy-ink);
  border: 4px solid rgba(255,255,255,.9);
  border-radius: 26px;
  background: linear-gradient(160deg, #f8fdff, #e4f6ff);
  box-shadow: 0 24px 70px rgba(16,62,105,.38);
}
.account-meta-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.account-meta-header h2 { margin: 0; font-size: 26px; }
.account-meta-header .section-kicker { margin-bottom: 3px; }
.account-meta-balance { padding: 9px 14px; color: #805600; border: 2px solid #edc438; border-radius: 999px; background: #fff8ce; font-weight: 900; white-space: nowrap; }
.account-meta-balance strong { font-size: 20px; }
.account-meta-help { margin: 10px 0 14px; color: var(--porandy-muted); font-size: 13px; line-height: 1.5; }
.account-meta-close { display: block; width: min(280px, 100%); min-height: 46px; margin: 18px auto 2px; color: #315a7a; border: 2px solid #b8d0df; border-radius: 13px; background: #fff; box-shadow: 0 4px 0 #c9dbe6; font: 900 14px inherit; cursor: pointer; }
.account-meta-close:focus-visible, .dex-entry button:focus-visible { outline: 3px solid var(--porandy-yellow); outline-offset: 2px; }
.dex-summary { margin-bottom: 12px; padding: 10px 13px; color: #466987; border: 1px solid #bad7e8; border-radius: 12px; background: rgba(255,255,255,.75); }
.dex-summary strong { color: var(--porandy-blue); font-size: 20px; }
.dex-summary span { float: right; color: #188653; font-weight: 900; }
.dex-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.dex-entry { min-width: 0; border-radius: 15px; }
.dex-entry.unlocked { padding: 11px; border: 3px solid var(--dex-rarity); background: #fff; box-shadow: 0 5px 13px rgba(37,86,126,.12); }
.dex-pokemon { display: flex; align-items: center; gap: 9px; min-width: 0; padding-bottom: 8px; border-bottom: 1px solid #dce9f1; }
.dex-pokemon img { width: 72px; height: 72px; flex: 0 0 72px; object-fit: contain; image-rendering: pixelated; border-radius: 11px; background: #edf7fc; }
.dex-pokemon-info { flex: 1; min-width: 0; }
.dex-pokemon small, .dex-pokemon strong, .dex-pokemon span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dex-pokemon small { color: #738aa0; font-size: 9px; font-weight: 800; }
.dex-pokemon strong { margin: 2px 0; font-size: 16px; }
.dex-pokemon span { color: #527493; font-size: 9px; }
.dex-batch-btn, .dex-all-max-btn {
  min-height: 34px; padding: 6px 10px; color: #fff; border: 0; border-radius: 9px;
  background: linear-gradient(180deg,#ef8a32,#d26416); box-shadow: 0 3px 0 #a3480a;
  font: 900 9px inherit; cursor: pointer; white-space: nowrap;
}
.dex-batch-btn:disabled, .dex-all-max-btn:disabled { color: #8090a0; background: #e3eaf0; box-shadow: none; cursor: not-allowed; }
.dex-upgrades { margin-top: 6px; }
.dex-upgrade-row { display: grid; grid-template-columns: 22px minmax(92px, 1fr) auto; align-items: center; gap: 6px; padding: 5px 0; }
.dex-upgrade-row + .dex-upgrade-row { border-top: 1px dashed #dce7ee; }
.dex-upgrade-row > span:first-child { text-align: center; }
.dex-upgrade-row b, .dex-upgrade-row small { display: block; }
.dex-upgrade-row b { font-size: 10px; }
.dex-upgrade-row small { color: #70889e; font-size: 8px; }
.dex-upgrade-actions { display: grid; grid-template-columns: repeat(2, minmax(72px, 1fr)); gap: 4px; }
.dex-upgrade-row button { min-width: 72px; min-height: 30px; padding: 5px 6px; color: #fff; border: 0; border-radius: 8px; background: linear-gradient(#8e61ce,#7046b2); font: 800 9px inherit; cursor: pointer; }
.dex-upgrade-row .dex-max-btn { background: linear-gradient(#338fc8,#216ea8); }
.dex-upgrade-row button:disabled { color: #8090a0; background: #e3eaf0; cursor: not-allowed; }
.dex-all-max-btn { width: 100%; margin-top: 8px; min-height: 38px; background: linear-gradient(180deg,#2da96c,#17864f); box-shadow: 0 3px 0 #0e653a; font-size: 10px; }
.dex-entry.locked { display: flex; min-height: 104px; flex-direction: column; align-items: center; justify-content: center; color: #8296a8; border: 2px dashed #b9ccda; background: rgba(235,242,247,.68); text-align: center; }
.dex-entry.locked > span { font-size: 28px; font-weight: 950; }
.dex-entry.locked strong { font-size: 12px; }
.dex-entry.locked small { font-size: 8px; }
.achievement-list { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 12px; }
.achievement-group { padding: 11px; border: 1px solid #c9deeb; border-radius: 14px; background: rgba(255,255,255,.62); }
.achievement-group h3 { margin: 0 0 7px; color: var(--porandy-blue); font-size: 13px; }
.achievement-row { display: grid; grid-template-columns: 31px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-width: 0; padding: 8px; color: #75899b; border: 1px solid #d9e5ed; border-radius: 10px; background: #f4f7f9; }
.achievement-row + .achievement-row { margin-top: 6px; }
.achievement-row.complete { color: #285e47; border-color: #8bd1aa; background: linear-gradient(135deg,#effff5,#dcf7e7); }
.achievement-icon { font-size: 21px; text-align: center; }
.achievement-row div { min-width: 0; }
.achievement-row strong, .achievement-row small { display: block; }
.achievement-row strong { overflow: hidden; color: inherit; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.achievement-row small { font-size: 9px; line-height: 1.3; }
.achievement-row > b { font-size: 9px; white-space: nowrap; }
.achievement-progress { height: 4px; margin-top: 5px; overflow: hidden; border-radius: 999px; background: #dbe5eb; }
.achievement-progress i { display: block; height: 100%; border-radius: inherit; background: #508fc1; }
.achievement-row.complete .achievement-progress i { background: #35a668; }

@media (max-width: 760px) {
  .account-meta-modal { align-items: flex-start; padding: 8px; }
  .account-meta-panel { max-height: calc(100dvh - 16px); padding: 14px; border-radius: 18px; }
  .account-meta-header h2 { font-size: 21px; }
  .dex-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .achievement-list { grid-template-columns: 1fr; }
}
@media (max-width: 430px) {
  .dex-grid { grid-template-columns: 1fr; }
}

/* Account card collection */
#card-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 5100;
  align-items: center;
  justify-content: center;
  padding: 18px;
  background: rgba(21, 55, 88, .58);
  backdrop-filter: blur(7px);
}
#card-modal.open { display: flex; }
.card-panel {
  width: min(980px, 100%);
  max-height: min(90dvh, 820px);
  overflow: auto;
  padding: 22px;
  color: var(--porandy-ink);
  border: 4px solid rgba(255,255,255,.9);
  border-radius: 26px;
  background: linear-gradient(160deg, #f8fdff, #e4f6ff);
  box-shadow: 0 24px 70px rgba(16,62,105,.34);
}
.card-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-modal-header h2 { margin: 0; font-size: 26px; }
.card-modal-header .section-kicker { margin-bottom: 3px; }
.card-balance { padding: 10px 15px; color: #805600; border: 2px solid #edc438; border-radius: 999px; background: #fff8ce; font-weight: 900; }
.card-balance strong { font-size: 22px; }
.shop-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0 10px; }
.shop-tab {
  min-height: 42px; border: 2px solid #afd1e4; border-radius: 12px; color: #456981;
  background: rgba(255,255,255,.72); font: 900 14px inherit; cursor: pointer;
}
.shop-tab.active { color: #fff; border-color: #155790; background: linear-gradient(180deg, #2d8fd0, #1769a5); box-shadow: 0 3px 0 #104b7c; }
.shop-pane[hidden] { display: none; }
.currency-summary { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 10px 0 14px; }
.currency-balance { padding: 14px; border: 2px solid #bad9e9; border-radius: 14px; background: #fff; text-align: center; }
.currency-balance span { display: block; margin-bottom: 4px; color: #628198; font-size: 11px; font-weight: 800; }
.currency-balance strong { color: #155790; font-size: 22px; }
.currency-exchanges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.currency-exchange {
  min-height: 92px; padding: 12px 8px; border: 2px solid #e1b72d; border-radius: 15px;
  color: #604300; background: linear-gradient(180deg, #fff7bd, #ffd94d); box-shadow: 0 4px 0 #ca9709;
  font: 900 15px inherit; cursor: pointer;
}
.currency-exchange small { display: block; margin-top: 7px; color: #765b18; font-size: 11px; }
.currency-exchange:disabled { cursor: not-allowed; filter: grayscale(.7); opacity: .5; box-shadow: none; }
.currency-status { min-height: 44px; margin: 14px 0; padding: 11px 13px; border: 1px solid #b9d7e8; border-radius: 12px; color: #315d7a; background: #fff; text-align: center; font-size: 13px; }
.currency-status[data-state="success"] { color: #12633d; border-color: #7bcaa5; background: #ebfff5; }
.currency-status[data-state="error"] { color: #9b2635; border-color: #e4a5ad; background: #fff1f3; }
.card-help { margin: 10px 0 14px; color: var(--porandy-muted); font-size: 13px; line-height: 1.5; }
.card-draw-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.card-draw-actions button, .card-close-btn {
  min-height: 48px;
  border: 2px solid #155790;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(180deg, #3188c8, #1765a4);
  box-shadow: 0 4px 0 #104b7c;
  font: 900 14px inherit;
  cursor: pointer;
}
.card-draw-actions .draw-advanced { color: #2b2455; border-color: #c79a14; background: linear-gradient(180deg, #ffe870, #ffc928); box-shadow: 0 4px 0 #c89405; }
.card-draw-actions button small { display: block; margin-top: 2px; font-size: 10px; opacity: .72; }
.card-draw-actions button:disabled { cursor: not-allowed; filter: grayscale(.75); opacity: .48; box-shadow: none; }
.card-draw-result { min-height: 40px; margin: 12px 0; padding: 10px 12px; color: #315d7a; border: 1px solid #b9d7e8; border-radius: 12px; background: #fff; font-size: 13px; text-align: center; }
.card-draw-result strong { color: #8a5700; }
.card-section { margin-top: 16px; }
.card-section h3 { display: flex; justify-content: space-between; margin: 0 0 8px; font-size: 15px; }
.card-section h3 span { color: var(--porandy-muted); font-size: 12px; }
.card-equipped-slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.card-slot { min-height: 176px; padding: 7px; border: 2px dashed #a9c3d7; border-radius: 16px; background: rgba(255,255,255,.55); }
.card-slot.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; color: #7991a7; text-align: center; }
.card-slot.empty strong { margin: 8px 0 4px; }
.slot-number { color: #416a91; font-size: 9px; font-weight: 950; letter-spacing: 1.2px; }
.card-synergies { margin-top: 12px; padding: 12px; border: 1px solid #c6dceb; border-radius: 14px; background: rgba(255,255,255,.68); }
.card-synergy-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.card-synergy-heading strong { color: #264e70; font-size: 14px; }
.card-synergy-heading span { color: #71889b; font-size: 10px; text-align: right; }
.card-synergy-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.card-synergy { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 7px; min-width: 0; padding: 8px 9px; color: #7890a3; border: 1px solid #d7e4ed; border-radius: 11px; background: #f4f8fb; }
.card-synergy.active { color: #275b43; border-color: #72c796; background: linear-gradient(135deg, #effff4, #dcf7e7); box-shadow: 0 3px 9px rgba(50,153,96,.13); }
.card-synergy-icon { font-size: 18px; text-align: center; }
.card-synergy div { min-width: 0; }
.card-synergy div strong, .card-synergy div small { display: block; }
.card-synergy div strong { overflow: hidden; color: inherit; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.card-synergy div small { margin-top: 2px; font-size: 9px; line-height: 1.3; }
.card-synergy > b { padding: 3px 5px; color: #8195a5; border-radius: 999px; background: #e7eef3; font-size: 9px; }
.card-synergy.active > b { color: #fff; background: #30a363; }
.card-collection { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-height: 330px; overflow: auto; padding: 2px; }
.pokemon-card { --rarity: #8596a8; position: relative; min-width: 0; padding: 11px; color: #233e5e; border: 3px solid var(--rarity); border-radius: 15px; background: linear-gradient(145deg, #fff, #eef7fb); box-shadow: 0 5px 12px rgba(37,86,126,.14); }
.pokemon-card.rarity-2 { --rarity: #36a86b; }
.pokemon-card.rarity-3 { --rarity: #388ee8; }
.pokemon-card.rarity-4 { --rarity: #9b5ed0; }
.pokemon-card.rarity-5 { --rarity: #f0ae16; background: linear-gradient(145deg, #fffbe6, #fff1b8); }
.pokemon-card.rarity-6 { --rarity: #ef4b45; background: linear-gradient(145deg, #fff1f1, #ffe4b8); }
.pokemon-card-top { display: flex; justify-content: space-between; color: #6d8197; font-size: 9px; font-weight: 900; }
.pokemon-card .card-rarity { color: var(--rarity); }
.pokemon-card-portrait { display: grid; place-items: center; height: 86px; margin: 5px 0 2px; overflow: hidden; border-radius: 11px; background: radial-gradient(circle, color-mix(in srgb, var(--rarity) 22%, #fff), rgba(255,255,255,.45) 64%); }
.pokemon-card-portrait img { width: 88px; height: 88px; object-fit: contain; image-rendering: pixelated; filter: drop-shadow(0 5px 5px rgba(31,66,94,.25)); }
.pokemon-card > strong { display: block; margin-top: 5px; overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.card-types { display: flex; flex-wrap: wrap; gap: 3px; margin: 5px 0; }
.card-types span { padding: 2px 5px; color: #42617d; border-radius: 999px; background: #dfedf5; font-size: 9px; }
.pokemon-card ul { min-height: 39px; margin: 7px 0; padding-left: 16px; color: #395c78; font-size: 10px; line-height: 1.35; }
.pokemon-card button { width: 100%; min-height: 30px; border: 0; border-radius: 9px; color: #fff; background: var(--rarity); font: 800 11px inherit; cursor: pointer; }
.card-collection .pokemon-card button:disabled { opacity: .55; }
.card-empty { grid-column: 1 / -1; padding: 34px; color: #6f879d; border: 2px dashed #bad0df; border-radius: 14px; background: rgba(255,255,255,.55); text-align: center; line-height: 1.6; }
.card-close-btn { display: block; width: min(280px, 100%); margin: 18px auto 2px; color: #315a7a; border-color: #b8d0df; background: #fff; box-shadow: 0 4px 0 #c9dbe6; }
.card-reveal { display: none; position: absolute; inset: 0; z-index: 3; align-items: center; justify-content: center; overflow: auto; padding: 18px; background: radial-gradient(circle at 50% 35%, rgba(255,234,112,.72), rgba(17,54,91,.93) 52%, rgba(7,25,47,.98)); }
.card-reveal.open { display: flex; animation: cardRevealFade .25s ease-out both; }
.card-pack { position: absolute; z-index: 2; display: grid; place-items: center; width: 150px; height: 210px; color: #fff; border: 8px solid #ffe252; border-radius: 16px; background: linear-gradient(145deg, #318bd0, #124a91); box-shadow: 0 0 0 5px #fff, 0 22px 70px rgba(0,0,0,.5); text-align: center; animation: cardPackOpen .8s ease-in both; }
.card-pack span { font-size: 52px; }
.card-pack b { font-size: 18px; letter-spacing: 2px; }
.card-reveal-burst { position: absolute; width: min(80vw, 650px); aspect-ratio: 1; border-radius: 50%; background: repeating-conic-gradient(from 0deg, rgba(255,244,145,.7) 0 4deg, transparent 4deg 14deg); opacity: 0; animation: cardBurst .9s .55s ease-out both; }
.card-reveal-content { position: relative; z-index: 1; width: min(900px, 100%); max-height: calc(100dvh - 36px); overflow: auto; padding: 20px; border: 4px solid rgba(255,255,255,.8); border-radius: 24px; background: rgba(238,248,255,.96); box-shadow: 0 24px 80px rgba(0,0,0,.45); text-align: center; opacity: 0; transform: scale(.86); animation: revealContentIn .45s .75s cubic-bezier(.2,.9,.3,1.2) forwards; }
.card-reveal-kicker { color: #dd8300; font-size: 12px; font-weight: 950; letter-spacing: 3px; }
.card-reveal-content h3 { margin: 4px 0 14px; color: #194c75; font-size: 24px; }
.card-reveal-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; }
.card-reveal-grid.single { width: min(260px, 100%); margin-inline: auto; grid-template-columns: 1fr; }
.card-reveal-item { min-width: 0; opacity: 0; transform: translateY(18px) rotateY(90deg); animation: revealCardIn .45s calc(.9s + var(--reveal-index) * 70ms) ease-out forwards; }
.card-reveal-item .pokemon-card { height: 100%; text-align: left; }
#btn-card-reveal-close { min-width: 180px; min-height: 44px; margin-top: 16px; border: 0; border-radius: 12px; color: #fff; background: linear-gradient(#338dcc,#1765a4); box-shadow: 0 4px 0 #104b7c; font: 900 14px inherit; cursor: pointer; }
@keyframes cardRevealFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cardPackOpen { 0% { opacity: 0; transform: scale(.3) rotate(-10deg); } 35% { opacity: 1; transform: scale(1.05) rotate(4deg); } 70% { opacity: 1; transform: scale(1) rotate(0); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes cardBurst { from { opacity: 0; transform: scale(.15) rotate(0); } 45% { opacity: .85; } to { opacity: 0; transform: scale(1.25) rotate(30deg); } }
@keyframes revealContentIn { to { opacity: 1; transform: scale(1); } }
@keyframes revealCardIn { to { opacity: 1; transform: translateY(0) rotateY(0); } }
@media (max-width: 720px) {
  #card-modal { align-items: flex-start; padding: 8px; }
  .card-panel { max-height: calc(100dvh - 16px); padding: 14px; border-radius: 18px; }
  .card-modal-header h2 { font-size: 21px; }
  .card-balance strong { font-size: 18px; }
  .currency-exchanges { grid-template-columns: 1fr; }
  .currency-exchange { min-height: 68px; }
  .card-collection { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-reveal { align-items: flex-start; padding: 8px; }
  .card-reveal-content { max-height: calc(100dvh - 16px); padding: 13px; border-radius: 17px; }
  .card-reveal-content h3 { font-size: 19px; }
  .card-reveal-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-reveal-grid.single { width: min(240px, 100%); }
  .card-equipped-slots { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .card-slot { min-height: 0; padding: 5px; }
  .card-slot.empty { min-height: 86px; }
  .card-slot .pokemon-card { padding: 7px; }
  .card-slot .pokemon-card-portrait { height: 62px; }
  .card-slot .pokemon-card-portrait img { width: 66px; height: 66px; }
  .card-synergy-heading { align-items: flex-start; flex-direction: column; gap: 2px; }
  .card-synergy-heading span { text-align: left; }
  .card-synergy-list { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .card-pack, .card-reveal-burst { display: none; }
  .card-reveal.open, .card-reveal-content, .card-reveal-item { animation: none; opacity: 1; transform: none; }
}

/* The orientation prompt is only relevant after the game canvas starts. */
@media (orientation: portrait) and (max-width: 900px) {
  #rotate-hint { display: none; }
  body.game-active #rotate-hint { display: flex; }
}

/* Tablet and compact desktop: retain the 3-zone information architecture. */
@media (max-width: 980px) and (min-height: 701px) {
  #start-overlay { align-items: flex-start; }
  .start-panel {
    width: min(760px, 100%);
    grid-template-columns: .82fr 1.18fr;
  }
  .start-brand { grid-row: span 2; }
}

/* Phones/tablets in landscape: a purpose-built compact horizontal dashboard. */
@media (orientation: landscape) and (max-height: 700px) {
  #start-overlay { align-items: flex-start; padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .start-panel {
    width: min(1040px, 100%);
    min-height: calc(100dvh - 16px);
    grid-template-columns: minmax(150px, .72fr) minmax(245px, 1.14fr) minmax(235px, 1fr);
    gap: 10px;
    padding: 10px;
    border-width: 2px;
    border-radius: 20px;
  }
  .start-brand, .start-account-card, .start-progress-card { padding: 12px; border-radius: 15px; }
  .start-account-card, .start-progress-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  .start-logo-image { width: min(100%, 200px); }
  .start-tagline { margin: 5px 0 9px; font-size: 10px; }
  .brand-chips { gap: 4px; }
  .brand-chips span { padding: 3px 6px; font-size: 8px; }
  .section-kicker { margin-bottom: 5px; font-size: 9px; }
  .sync-status { min-height: 28px; margin-bottom: 6px; padding: 5px 7px; font-size: 9px; }
  .start-panel button { min-height: 34px; margin-bottom: 6px; padding: 6px 10px; border-radius: 9px; font-size: 11px; }
  .user-info { margin-bottom: 6px; padding: 6px 8px; }
  .user-info img { width: 31px; height: 31px; }
  .user-info .name { font-size: 11px; }
  .user-info .status { font-size: 8px; }
  .run-resume-card { margin: 5px 0; padding: 5px 7px; font-size: 9px; line-height: 1.25; }
  .run-resume-card strong { font-size: 10px; }
  .btn-logout { min-height: 30px !important; }
  .stage-selector { margin-bottom: 6px; }
  .stage-btn { min-height: 47px !important; padding: 5px !important; }
  .stage-btn .stage-label { font-size: 7px; }
  .stage-btn .stage-name { font-size: 9px; }
  .best-record { margin-top: 3px; padding: 7px 9px; font-size: 10px; }
  .best-record .wave { font-size: 14px; }
}

/* Narrow landscape phones: preserve all three zones without horizontal overflow. */
@media (orientation: landscape) and (max-height: 700px) and (max-width: 720px) {
  #start-overlay { padding: max(5px, env(safe-area-inset-top)) max(5px, env(safe-area-inset-right)) max(5px, env(safe-area-inset-bottom)) max(5px, env(safe-area-inset-left)); }
  .start-panel {
    width: 100%;
    min-height: calc(100dvh - 10px);
    grid-template-columns: minmax(0, .7fr) minmax(0, 1.25fr) minmax(0, 1.05fr);
    gap: 6px;
    padding: 6px;
    border-radius: 14px;
  }
  .start-brand, .start-account-card, .start-progress-card { min-width: 0; padding: 7px; border-radius: 11px; }
  .start-logo-image { width: min(100%, 130px); }
  .start-tagline, .brand-chips { display: none; }
  .section-kicker { font-size: 7px; letter-spacing: 1px; }
  .sync-status { min-height: 23px; padding: 3px 5px; font-size: 7px; }
  .start-panel button { min-width: 0; min-height: 27px; padding: 3px 5px; font-size: 8px; }
  .user-info { gap: 6px; padding: 4px 5px; }
  .user-info img { width: 25px; height: 25px; }
  .user-info .name { font-size: 9px; }
  .user-info .status { font-size: 7px; }
  .run-resume-card { padding: 3px 5px; font-size: 7px; }
  .btn-logout { min-height: 25px !important; }
  .stage-btn { min-height: 39px !important; }
  .stage-btn .stage-name { font-size: 7px; }
  .best-record { padding: 5px 6px; font-size: 8px; }
}

/* Phone portrait menu: full-width scrollable cards, no clipping. */
@media (orientation: portrait) and (max-width: 700px) {
  #start-overlay {
    align-items: flex-start;
    padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
    background-position: 58% center;
  }
  .start-panel {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 10px;
    border-width: 2px;
    border-radius: 20px;
  }
  .start-brand, .start-account-card, .start-progress-card { padding: 15px; border-radius: 16px; }
  .start-brand { min-height: auto; }
  .start-logo-image { width: min(72vw, 270px); }
  .start-tagline { display: none; }
  .brand-chips { margin-top: 2px; }
  .section-kicker { margin-bottom: 7px; }
  .start-panel button { min-height: 46px; }
  .user-info { margin-bottom: 8px; }
  .stage-selector { display: grid; grid-template-columns: 1fr; }
  .stage-btn { min-width: 0; }
}

@media (max-width: 360px) {
  .start-panel { padding: 7px; gap: 7px; }
  .start-brand, .start-account-card, .start-progress-card { padding: 11px; }
  .start-logo-image { width: 220px; }
}

@media (prefers-reduced-motion: reduce) {
  #start-overlay, .start-panel button { animation: none; transition: none; }
}


/* The play screen is the main entrance: large controls, a room browser and account tools. */
#start-overlay { padding: clamp(14px, 3vw, 48px); }
.start-panel { width: min(1600px, 100%); min-height: min(730px, calc(100dvh - 72px)); grid-template-columns: minmax(250px, .92fr) minmax(330px, 1.12fr) minmax(300px, 1fr); gap: 24px; padding: 24px; }
.start-brand, .start-account-card, .start-progress-card { padding: 26px; }
.start-brand { justify-content: flex-start; padding-top: 34px; }
.aiedu-wordmark { display: block; font-size: 21px; letter-spacing: 6px; font-weight: 900; color: #174f9b; }
.start-logo-image { width: min(100%, 310px); margin-top: 4px; }
.start-tagline { display: block; font-size: 17px; line-height: 1.7; margin: 12px 0 20px; }
.brand-chips { display: flex; }
.brand-chips span { font-size: 12px; padding: 7px 10px; }
.start-launch { width: 100%; margin-top: auto; padding-top: 34px; position: relative; z-index: 1; }
.play-mode-tabs { display: grid; grid-template-columns: 1fr 1fr; padding: 5px; border-radius: 15px; background: #dfeefa; gap: 6px; }
.start-panel .play-mode-tabs button { margin: 0; border: 0; background: transparent; color: #466887; box-shadow: none; font-size: 18px; font-weight: 900; }
.start-panel .play-mode-tabs button[aria-pressed="true"] { background: #fff; color: #175496; box-shadow: 0 3px 9px #17345f1c; }
#play-mode-hint { min-height: 36px; margin: 14px 0; color: #526e8c; font-size: 13px; line-height: 1.6; }
.start-panel #btn-play-start { min-height: 80px; width: 100%; font-size: 25px; font-weight: 950; gap: 14px; margin-bottom: 6px; }
.start-panel button { font-size: 16px; min-height: 48px; }
.start-panel button:disabled, .menu-dialog button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.section-kicker { font-size: 12px; margin-bottom: 15px; }
.start-account-card h2 { margin: 14px 0; color: #17345f; font-size: clamp(26px, 2.1vw, 36px); line-height: 1.35; letter-spacing: -1px; }
.menu-description { color: #5d7698; font-size: 15px; line-height: 1.7; margin: 12px 0 20px; }
.starter-team { display: flex; justify-content: center; gap: 4px; padding: 8px 0 22px; }
.starter-team img { width: 30%; max-width: 124px; image-rendering: pixelated; }
.adventure-note { border-top: 1px solid #dbe9f0; padding-top: 18px; margin-top: 16px; }
.adventure-note b { font-size: 16px; color: #174f9b; }
.adventure-note p { font-size: 14px; line-height: 1.7; margin: 8px 0 0; color: #5d7698; }
.sync-status { font-size: 12px; line-height: 1.6; padding: 10px 12px; }
.user-info .name { font-size: 18px; }
.user-info .status { font-size: 12px; }
.user-info img { width: 46px; height: 46px; }
.trainer-tools-title { padding-top: 16px; margin: 10px 0 12px; border-top: 1px solid #dbe9f0; font-size: 13px; color: #5d7698; font-weight: 800; }
#btn-guest-start { width: 100%; font-weight: 800; }
#btn-guest-start[aria-pressed="true"] { border: 2px solid #268265; background: #e9f9f0; color: #176a4e; }
.guest-help { font-size: 12px; color: #617c96; line-height: 1.7; }
.account-meta-actions .up-badge { font-size: 12px; }
.room-browser-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.room-browser-header h2 { font-size: 28px; }
#btn-room-refresh { width: 45px; border: 1px solid #c4dcec; background: #edf7ff; color: #174f9b; flex-shrink: 0; }
#room-browser-status { color: #5d7698; font-size: 13px; line-height: 1.6; min-height: 40px; }
.room-list { display: grid; gap: 12px; min-height: 245px; max-height: 430px; align-content: start; overflow-y: auto; padding: 4px 2px 14px; }
.start-panel .room-card { width: 100%; text-align: left; padding: 17px; margin: 0; border: 1px solid #b5d2e6; background: #f4fbff; color: #17345f; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.room-card b, .room-card small { display: block; overflow-wrap: anywhere; }
.room-card b { font-size: 17px; line-height: 1.5; }
.room-card small { font-size: 12px; color: #66819a; margin-top: 6px; }
.room-card .room-stage { display: inline-block; font-size: 11px; padding: 3px 8px; border-radius: 6px; background: #e0efff; color: #175496; margin-bottom: 6px; }
.room-card .room-stage.hard { background: #f0e5fc; color: #753daa; }
.room-card .room-join { color: #175496; font-size: 13px; flex-shrink: 0; font-weight: 900; }
#coop-browser #btn-coop-create { width: 100%; margin-top: 14px; }
.menu-dialog { margin: auto; width: min(600px, calc(100vw - 28px)); max-height: calc(100dvh - 32px); padding: 32px; overflow-y: auto; border: 3px solid #fff; border-radius: 24px; color: #17345f; background: #f4fbff; box-shadow: 0 24px 100px #09284666; }
.menu-dialog::backdrop { background: #102f58aa; backdrop-filter: blur(5px); }
.menu-dialog h2 { margin: 8px 24px 12px 0; font-size: 27px; line-height: 1.4; }
.menu-dialog h3 { font-size: 15px; margin: 22px 0 12px; }
.menu-dialog label { display: block; margin: 18px 0 8px; color: #355678; font-size: 14px; font-weight: 800; }
.menu-dialog label small { font-weight: normal; color: #6e869d; }
.menu-dialog input { display: block; width: 100%; border: 1px solid #a9c6dc; border-radius: 11px; padding: 13px 14px; font: inherit; font-size: 16px; color: #17345f; background: #fff; }
.menu-dialog button { min-height: 48px; border-radius: 12px; padding: 12px 16px; font: inherit; font-weight: 800; cursor: pointer; }
.menu-dialog .dialog-close { position: absolute; top: 10px; right: 12px; min-height: 36px; padding: 2px 10px; border: 0; background: transparent; color: #54728c; font-size: 30px; }
.menu-dialog .stage-selector { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.menu-dialog .stage-btn { min-height: 114px; text-align: left; padding: 16px !important; border: 2px solid #bdd3e3; }
.menu-dialog .stage-btn span, .menu-dialog .stage-btn small { display: block; }
.menu-dialog .stage-btn .stage-name { font-size: 22px; margin: 8px 0; }
.menu-dialog .stage-btn small { font-size: 12px; }
.menu-dialog .stage-btn .stage-label { font-size: 10px; }
.menu-dialog .run-resume-card { padding: 16px; font-size: 14px; line-height: 1.8; }
.resume-team { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
.resume-team span { background: #fff; border-radius: 6px; padding: 3px 7px; color: #17345f; font-size: 12px; }
.launch-dialog-actions { display: flex; gap: 12px; margin-top: 24px; }
.launch-dialog-actions button { flex: 1; margin: 0; }
#btn-aiedu-submit { width: 100%; margin-top: 16px; }
#aiedu-login-error, #launch-error { color: #b52d45; font-size: 13px; line-height: 1.6; }
.menu-dialog :focus-visible { outline: 3px solid #edb500; outline-offset: 3px; }
#game-container canvas { image-rendering: auto; }
@media (min-width: 1051px) and (max-height: 800px) { .start-panel { min-height: 0; } .start-brand, .start-account-card, .start-progress-card { padding: 20px; } .start-panel button { min-height: 42px; margin-bottom: 7px; } .start-tagline { font-size: 15px; } .starter-team { padding-bottom: 6px; } }
@media (max-width: 1050px) { #start-overlay { align-items: flex-start; padding: 16px; } .start-panel { grid-template-columns: 1fr 1.15fr; padding: 16px; gap: 16px; min-height: 0; } .start-progress-card { grid-column: 1 / -1; } .start-brand, .start-account-card, .start-progress-card { padding: 22px; } .start-launch { padding-top: 28px; } .start-logo-image { width: min(100%, 250px); } }
@media (max-width: 700px) { #start-overlay { padding: 10px; } .start-panel { grid-template-columns: 1fr; padding: 10px; gap: 12px; border-width: 2px; } .start-progress-card { grid-column: auto; order: 2; } .start-account-card { order: 3; } .menu-coop .start-account-card { order: 2; } .menu-coop .start-progress-card { order: 3; } .start-brand { order: 1; padding-top: 22px; } .start-logo-image { width: 240px; } .aiedu-wordmark { font-size: 17px; } .start-tagline { font-size: 14px; margin: 8px 0 12px; } .start-panel button { min-height: 48px; font-size: 15px; } .start-panel #btn-play-start { min-height: 68px; font-size: 23px; } .start-launch { padding-top: 24px; } .start-brand, .start-account-card, .start-progress-card { padding-inline: 18px; } .menu-dialog { padding: 24px 20px; } .menu-dialog h2 { font-size: 24px; } .menu-dialog .stage-btn { padding: 12px !important; } }
[hidden] { display: none !important; }

.coop-code-value { font-size: 20px; letter-spacing: 0; line-height: 1.5; overflow-wrap: anywhere; }
