/* Dedicated phone layout. Desktop/tablet layouts above 780px are intentionally untouched. */
.mobile-menu-toggle{display:none}

@media(max-width:780px){
  .trainer-title-slot{flex-wrap:nowrap!important;gap:5px!important;min-width:0}
  .trainer-title-slot>.trainer-title-badge{min-width:0;flex:0 1 auto}
  .trainer-title-slot .trainer-title-label{min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
  .trainer-title-slot>.owner-profile-edit-title{flex:0 0 auto}
  :root{--mobile-gutter:14px;--mobile-header:68px}
  html{scroll-padding-top:calc(var(--mobile-header) + 12px)}
  body{font-size:14px;overscroll-behavior-x:none}
  body.mobile-nav-open{overflow:hidden}
  .ambient{width:360px;height:360px;filter:blur(95px);opacity:.1}

  /* Header: one compact row plus a real mobile drawer. */
  .site-header{position:sticky!important;top:0;z-index:1000;height:calc(var(--mobile-header) + env(safe-area-inset-top))!important;min-height:calc(var(--mobile-header) + env(safe-area-inset-top))!important;padding:env(safe-area-inset-top) var(--mobile-gutter) 0!important;display:flex!important;flex-wrap:nowrap!important;gap:8px!important;background:#10101df2;backdrop-filter:blur(18px);-webkit-backdrop-filter:blur(18px);border-bottom:1px solid var(--line)}
  .site-header .brand{order:0;min-width:0!important;flex:0 1 auto;gap:8px!important}
  .site-header .brand .pokeball{width:31px!important;height:31px!important}
  .site-header .brand .pokeball:after{width:9px!important;height:9px!important;top:7px!important;left:7px!important;border-width:3px!important}
  .site-header .brand strong{font-size:12px!important;letter-spacing:1.65px!important;white-space:nowrap}
  .site-header .brand small{display:none!important}
  .site-header .account-area{order:1;min-width:0!important;margin-left:auto;flex:0 1 auto}
  .site-header .profile-chip{max-width:136px;padding:6px 8px!important;gap:6px!important;min-height:42px}
  .site-header .profile-chip .trainer-name,.site-header .profile-chip>span:not(.trainer-avatar):not(.trainer-country){overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:76px}
  .site-header .profile-chip-name{min-width:0!important}
  .site-header .profile-chip-name>.trainer-name-text{min-width:0!important;overflow:hidden!important;text-overflow:ellipsis!important;white-space:nowrap!important;flex:1 1 auto!important}
  .site-header .account-area>.button{min-height:42px;padding:8px 10px!important;font-size:9px!important;gap:7px!important;white-space:nowrap}
  .site-header .trainer-avatar.header,.site-header .avatar{width:27px!important;height:27px!important;flex:0 0 27px}
  .site-header .trainer-country{flex:0 0 auto!important}
  .site-header .trainer-country>.trainer-country-image{width:20px!important;height:14px!important;min-width:20px!important;max-width:20px!important;flex:0 0 20px!important;object-fit:cover!important}
  .site-header .trainer-country>.trainer-country-flag{width:20px!important;min-width:20px!important;flex:0 0 20px!important}
  .mobile-menu-toggle{order:2;display:inline-flex;flex:0 0 44px;width:44px;height:44px;padding:0;border:1px solid #ffffff16;border-radius:12px;background:#ffffff05;align-items:center;justify-content:center;flex-direction:column;gap:4px;color:var(--ink)}
  .mobile-menu-toggle span{display:block;width:18px;height:2px;border-radius:2px;background:currentColor;transition:transform .18s,opacity .18s}
  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(1){transform:translateY(6px) rotate(45deg)}
  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(2){opacity:0}
  .mobile-menu-toggle[aria-expanded="true"] span:nth-child(3){transform:translateY(-6px) rotate(-45deg)}
  .site-header .nav{position:fixed!important;top:calc(var(--mobile-header) + env(safe-area-inset-top) + 8px);left:var(--mobile-gutter);right:var(--mobile-gutter);z-index:1200;width:auto!important;display:none!important;flex-direction:column!important;align-items:stretch!important;gap:4px!important;padding:9px!important;border:1px solid #ffffff16!important;border-radius:17px!important;background:#171625fa!important;box-shadow:0 24px 70px #000a!important;backdrop-filter:blur(20px);-webkit-backdrop-filter:blur(20px)}
  body.mobile-nav-open .site-header .nav,.site-header .nav.mobile-nav-visible{display:flex!important}
  .site-header .nav-link{display:flex!important;align-items:center!important;justify-content:flex-start!important;width:100%!important;min-height:46px!important;flex:none!important;padding:11px 13px!important;border-radius:10px!important;font-size:13px!important;text-align:left!important}
  .site-header .nav-link.active{background:#a78bfa14!important}
  .profile-menu{position:fixed!important;top:calc(var(--mobile-header) + env(safe-area-inset-top) + 8px)!important;right:var(--mobile-gutter)!important;left:var(--mobile-gutter)!important;width:auto!important;max-height:calc(100dvh - var(--mobile-header) - 36px);overflow:auto;z-index:1250}

  /* Shared page framing and safe areas. */
  main{width:100%;max-width:none!important;padding:0 var(--mobile-gutter)!important;min-height:calc(100dvh - 170px)!important}
  .view{max-width:100%}
  .button{min-height:44px}
  .button:hover{transform:none}
  .site-footer{padding:22px var(--mobile-gutter) calc(20px + env(safe-area-inset-bottom))!important;display:flex!important;flex-direction:column!important;align-items:center!important;text-align:center!important;gap:9px!important;font-size:8px!important;line-height:1.55}
  .site-footer>span:last-child{display:block!important;max-width:560px}
  .site-footer .text-link{display:inline-block;margin:4px 5px 0;font-size:9px!important}

  /* Home: keep the desktop identity, remove phone clutter. */
  .home-view{display:block!important;padding-top:30px!important}
  .home-pokemon-cloud{display:none!important}
  .hero-copy{text-align:center!important;max-width:500px;margin:0 auto}
  .hero-copy .eyebrow{justify-content:center}
  .hero-copy h1{font-size:clamp(38px,11.5vw,52px)!important;line-height:1.2!important;letter-spacing:-2.3px!important;white-space:normal!important;margin-top:12px!important}
  .hero-copy h1 br:first-of-type{display:initial!important}
  .hero-description{margin-top:16px!important;font-size:12px!important;line-height:1.65!important;padding:0 8px}
  .hero-actions{display:grid!important;grid-template-columns:1fr!important;gap:9px!important;margin:20px auto 0!important;width:min(100%,380px)!important}
  .hero-actions .button{width:100%!important;min-width:0!important;font-size:14px!important;padding:13px 18px!important}
  .hero-note{justify-content:center!important;font-size:9px!important;margin-top:1px}
  .fun-button-note{display:block!important;font-size:9px!important;line-height:1.4!important;color:var(--dim);text-align:center}
  .resume-note{font-size:10px!important;margin-top:8px!important}
  .hero-art{height:255px!important;max-width:350px!important;margin:25px auto 0!important}
  .hero-art .orbit,.hero-art .spark,.hero-art .floating-question{display:none!important}
  .preview-card{width:47%!important;height:218px!important;top:8px!important;padding:13px 6px!important;border-radius:17px!important;box-shadow:0 14px 35px #0004!important}
  .preview-left{left:2%!important;transform:rotate(-3deg)!important}
  .preview-right{right:2%!important;transform:rotate(3deg)!important}
  .preview-card img,.preview-card .image-fallback{width:128px!important;height:128px!important;max-width:100%!important;margin:0 auto -2px!important}
  .preview-card h2{font-size:17px!important;margin-bottom:5px!important}
  .preview-card .type{font-size:7px!important;padding:2px 7px!important}
  .preview-vs{top:100px!important;left:50%!important;width:34px!important;height:34px!important;font-size:8px!important}
  .numbers-strip{margin-top:18px!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;padding:14px 4px!important;border-radius:13px!important}
  .numbers-strip>div,.numbers-strip>div:first-child{padding:0 6px!important}
  .numbers-strip>div:nth-child(3){border-right:0!important}
  .numbers-strip strong{font-size:19px!important}
  .numbers-strip span{font-size:8px!important;line-height:1.25!important}
  .numbers-message{display:none!important}
  .home-bottom{margin:18px 0 30px!important;text-align:center!important;display:block!important}
  .home-bottom>span{font-size:7px!important;display:block!important}
  .home-bottom .text-link{font-size:11px!important;margin-top:7px!important}

  /* Ranked / For Fun: intentionally HORIZONTAL cards on phones. */
  #game-view:not(.hidden){padding:12px 0 calc(26px + env(safe-area-inset-bottom))!important;margin:0 auto!important;max-width:680px!important}
  #game-view .game-toolbar{display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;gap:8px 10px!important;align-items:center!important;margin-bottom:4px!important}
  #game-view .back-link{font-size:10px!important;white-space:nowrap}
  #game-view .scoreboard{justify-self:end!important;gap:9px!important;padding:7px 10px!important;border-radius:11px!important}
  #game-view .scoreboard small{font-size:6px!important;letter-spacing:.7px!important}
  #game-view .scoreboard strong{font-size:17px!important}
  #game-view .scoreboard .best-score{font-size:14px!important}
  #game-view .score-divider{height:25px!important}
  #game-view .score-flame{font-size:12px!important;margin-right:4px!important}
  #game-view .streak-state{grid-column:1/-1!important;justify-self:center!important;margin:0!important;font-size:6px!important;padding:4px 7px!important}
  #game-view .question-section{position:sticky!important;top:calc(var(--mobile-header) + env(safe-area-inset-top));z-index:80;margin:4px calc(-1 * var(--mobile-gutter)) 12px!important;padding:9px var(--mobile-gutter) 10px!important;background:linear-gradient(180deg,#10101dfc 78%,#10101de8 90%,transparent)!important;backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px)}
  #game-view .round-meta{margin-bottom:5px!important;font-size:7px!important}
  #game-view #question{font-size:clamp(19px,5.7vw,24px)!important;line-height:1.16!important;letter-spacing:-.55px!important;margin:0 auto!important;max-width:96%!important}
  #game-view .question-section p{font-size:8px!important;line-height:1.35!important;margin-top:6px!important;min-height:0!important}
  #game-view .live-round-timer{width:min(310px,90vw)!important;margin:6px auto 7px!important;padding:7px 10px 8px!important;border-radius:11px!important}
  #game-view .live-timer-row small{font-size:6px!important;letter-spacing:1.1px!important}
  #game-view .live-timer-row strong{font-size:23px!important}
  #game-view .live-timer-track{height:4px!important;margin-top:6px!important}
  #game-view .matchup{display:grid!important;grid-template-columns:minmax(0,1fr) minmax(0,1fr)!important;gap:8px!important;align-items:stretch!important;width:100%!important;max-width:100%!important;margin:0 auto!important}
  #game-view .pokemon-card{min-width:0!important;min-height:255px!important;padding:11px 7px 0!important;border-radius:15px!important;overflow:hidden!important}
  #game-view .pokemon-card .card-label{font-size:6px!important;letter-spacing:.35px!important;min-height:14px!important;white-space:normal!important;line-height:1.2!important}
  #game-view .pokemon-card .card-art{height:clamp(112px,31vw,155px)!important;display:grid!important;place-items:center!important}
  #game-view .pokemon-card img{width:100%!important;height:clamp(112px,31vw,155px)!important;max-width:155px!important;object-fit:contain!important;margin:0 auto!important}
  #game-view .image-fallback{height:clamp(112px,31vw,155px)!important;font-size:52px!important}
  #game-view .pokemon-card h2{font-size:clamp(14px,4.3vw,19px)!important;line-height:1.08!important;letter-spacing:-.45px!important;margin:0 0 4px!important;overflow-wrap:anywhere!important}
  #game-view .form-name{font-size:7px!important;min-height:10px!important;margin-bottom:3px!important}
  #game-view .pokemon-card .types{gap:3px!important;flex-wrap:wrap!important}
  #game-view .pokemon-card .type{font-size:6px!important;padding:2px 5px!important}
  #game-view .key-badge{display:none!important}
  #game-view .card-answer{margin:10px -7px 0!important;padding:9px 4px!important;min-height:46px!important;font-size:8px!important}
  #game-view .card-answer .answer-label{font-size:6px!important;letter-spacing:.2px!important}
  #game-view .card-answer strong{font-size:18px!important;margin:2px 0!important}
  #game-view .card-answer small{font-size:7px!important;line-height:1.2!important}
  #game-view .card-judgment{font-size:6px!important}
  #game-view .versus{width:28px!important;height:28px!important;top:43%!important;font-size:7px!important;border-color:#6d5a7d!important;box-shadow:0 5px 15px #0008!important}
  #game-view .round-feedback{max-width:100%!important;margin:10px auto 0!important;min-height:45px!important;gap:8px!important;font-size:10px!important;line-height:1.35!important;flex-wrap:wrap!important}
  #game-view .round-feedback .button{min-height:40px!important;font-size:9px!important;padding:8px 12px!important}
  #game-view .game-bottom{max-width:100%!important;margin:8px auto 0!important;justify-content:center!important;gap:10px!important;min-height:30px!important}
  #game-view .keyboard-hint{display:none!important}
  #game-view .switch-label{font-size:9px!important}
  #game-view .sound-toggle{margin-left:0!important;min-height:36px!important;font-size:8px!important}
  .fx-layer .fx-particle:nth-of-type(n+15){display:none!important}
  .streak-atmosphere i:nth-child(n+5){display:none!important}

  /* Leaderboards become readable mobile cards instead of a crushed table. */
  .leaderboard-view{padding:28px 0 42px!important;max-width:620px!important;margin:0 auto!important}
  .leaderboard-heading{margin-bottom:17px!important;text-align:center!important}
  .leaderboard-heading h1{font-size:clamp(31px,9vw,42px)!important;line-height:1.2!important;letter-spacing:-1.5px!important}
  .daily-reset-timer{min-width:0!important;width:min(220px,100%)!important;margin:13px auto 0!important}
  .your-rank{display:grid!important;grid-template-columns:1fr!important;gap:4px!important;padding:12px 14px!important;margin-bottom:14px!important;font-size:10px!important;text-align:center!important}
  #leaderboard-content .leaderboard-table{display:block!important;width:100%!important;border:0!important;background:transparent!important;overflow:visible!important;border-spacing:0!important}
  #leaderboard-content .leaderboard-table thead{display:none!important}
  #leaderboard-content .leaderboard-table tbody{display:grid!important;gap:8px!important;width:100%!important}
  #leaderboard-content .leaderboard-table tr{display:grid!important;grid-template-columns:auto minmax(0,1fr) auto!important;grid-template-rows:auto auto!important;align-items:center!important;column-gap:10px!important;row-gap:2px!important;padding:11px 12px!important;border:1px solid var(--line)!important;border-radius:14px!important;background:#ffffff035!important}
  #leaderboard-content .leaderboard-table tr.is-you{background:#a78bfa0d!important;border-color:#a78bfa2d!important}
  #leaderboard-content .leaderboard-table td{display:block!important;width:auto!important;padding:0!important;border:0!important;text-align:left!important;font-size:10px!important;min-width:0!important}
  #leaderboard-content .leaderboard-table td:nth-child(1){grid-column:1;grid-row:1/3;align-self:center}
  #leaderboard-content .leaderboard-table td:nth-child(2){grid-column:2;grid-row:1/3;min-width:0}
  #leaderboard-content .leaderboard-table td:nth-child(3){grid-column:3;grid-row:1;text-align:right!important}
  #leaderboard-content .leaderboard-table td:nth-child(4){grid-column:3;grid-row:2;text-align:right!important;color:var(--dim)!important;font-size:9px!important}
  #leaderboard-content .trainer-profile-link,#leaderboard-content .trainer-cell{max-width:100%!important;min-width:0!important;gap:7px!important;padding:2px!important}
  #leaderboard-content .trainer-name{display:inline-block;max-width:112px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  #leaderboard-content .trainer-avatar{width:32px!important;height:32px!important;border-radius:9px!important}
  #leaderboard-content .trainer-country>.trainer-country-image{width:19px!important;height:14px!important}
  #leaderboard-content .rank-medal{font-size:10px!important;white-space:nowrap}
  #leaderboard-content .streak-number{font-size:16px!important}
  #leaderboard-content .achievement-board-total{font-size:9px!important}
  .leaderboard-footnote{font-size:8px!important;line-height:1.45!important;margin-top:15px!important;padding:0 8px}
  .center .button{width:100%!important}

  /* Account hub: turn the desktop sidebar into a horizontal phone tab bar. */
  .account-hub-view{width:100%!important;padding:18px 0 48px!important;min-height:0!important}
  .account-hub-shell{display:block!important}
  .account-sidebar{position:sticky!important;top:calc(var(--mobile-header) + env(safe-area-inset-top));z-index:70;padding:6px 0!important;margin:0 0 10px!important;border:0!important;border-radius:0!important;background:#10101df2!important;box-shadow:0 10px 22px #0003!important;backdrop-filter:blur(14px);-webkit-backdrop-filter:blur(14px)}
  .account-sidebar-user{display:none!important}
  .account-sidebar nav{display:flex!important;grid-template-columns:none!important;gap:5px!important;overflow-x:auto!important;padding:2px 1px 5px!important;scrollbar-width:none;overscroll-behavior-x:contain}
  .account-sidebar nav::-webkit-scrollbar{display:none}
  .account-side-button{flex:0 0 auto!important;width:auto!important;min-height:40px!important;padding:9px 12px!important;font-size:10px!important;white-space:nowrap!important;border:1px solid #ffffff0b!important}
  .account-panel{min-height:0!important;padding:16px!important;border-radius:17px!important}
  .account-panel-heading{margin-bottom:17px!important}
  .account-panel-heading h1{font-size:clamp(30px,9vw,42px)!important;letter-spacing:-1.4px!important}
  .account-panel-heading>span{font-size:7px!important}
  .profile-hero{padding:16px!important;gap:14px!important;border-radius:16px!important;align-items:center!important}
  .account-panel .profile-hero{flex-direction:column!important;align-items:flex-start!important;padding:17px!important}
  .trainer-avatar.hero{width:76px!important;height:76px!important;border-radius:18px!important;flex:0 0 76px!important}
  .profile-hero h1{font-size:clamp(27px,8.5vw,38px)!important;letter-spacing:-1.4px!important;overflow-wrap:anywhere}
  .profile-hero p{font-size:10px!important;margin-top:5px!important}
  .profile-section-card{padding:16px!important;border-radius:14px!important}
  .profile-section-card h2{font-size:16px!important}
  .profile-section-card p{font-size:11px!important;line-height:1.5!important}
  .profile-stats-grid{display:grid!important;grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:7px!important}
  .profile-stat-card{min-height:105px!important;padding:13px 10px!important;border-radius:14px!important}
  .profile-stat-card small{font-size:7px!important;letter-spacing:.7px!important}
  .profile-stat-card strong{font-size:34px!important;letter-spacing:-1px!important}
  .avatar-options{grid-template-columns:repeat(3,minmax(0,1fr))!important;gap:7px!important}
  .avatar-option{padding:8px 4px!important;font-size:9px!important}
  .avatar-option img,.avatar-option-default{width:58px!important;height:58px!important;border-radius:11px!important}
  .color-options{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:7px!important}
  .color-option{min-height:42px!important;padding:8px!important;font-size:9px!important}
  .personalization-section{padding:14px!important;border-radius:15px!important}
  .personalization-save{flex-direction:column!important;align-items:stretch!important;gap:8px!important;margin-top:12px!important}
  .personalization-save .button{width:100%!important}
  .achievement-summary{grid-template-columns:1fr 1fr!important;padding:14px!important;gap:9px!important}
  .achievement-summary p{grid-column:1/-1!important;font-size:10px!important}
  .achievement-grid{grid-template-columns:1fr!important}
  .achievement-card{min-height:0!important}
  .account-admin-panel{padding:13px!important}
  .account-admin-nav{display:flex!important;overflow-x:auto!important;flex-wrap:nowrap!important;padding-bottom:5px!important;scrollbar-width:none}
  .account-admin-nav::-webkit-scrollbar{display:none}
  .account-admin-nav button{flex:0 0 auto!important;min-height:40px!important}
  .admin-summary{grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:8px!important}
  .admin-panel{padding:14px!important}
  .admin-search{flex-direction:column!important}
  .admin-search input{max-width:none!important}

  /* Public profiles remain rich, but flow naturally on a narrow screen. */
  .public-profile-view,.profile-hub-view{width:100%!important;padding:22px 0 48px!important;min-height:0!important}
  .public-profile-back{margin-bottom:14px!important}
  .public-profile-view .profile-hero{flex-direction:column!important;align-items:flex-start!important;padding:17px!important}
  .public-profile-view .trainer-avatar.hero,.account-panel .trainer-avatar.hero{width:88px!important;height:88px!important;flex-basis:88px!important}
  .public-profile-view .profile-hero h1,.account-panel .profile-hero h1{font-size:clamp(31px,10vw,43px)!important}
  .public-profile-view .profile-stats-grid{grid-template-columns:repeat(3,minmax(0,1fr))!important}
  .public-profile-view .profile-stat-card{min-height:105px!important}
  .public-achievements{padding:13px!important}
  .public-achievement-grid{grid-template-columns:1fr!important}
  .contact-card{padding:16px!important;border-radius:16px!important}
  .contact-intro{font-size:13px!important;line-height:1.55!important}
  .contact-card textarea{min-height:150px!important}
  .contact-form-bottom{flex-direction:column!important;align-items:stretch!important}
  .contact-form-bottom .button{width:100%!important}

  /* Daily Chest scales as a phone-native reward screen. */
  .daily-chest-view{width:100%!important;padding:22px 0 48px!important;min-height:0!important}
  .daily-chest-heading{display:flex!important;flex-direction:column!important;align-items:stretch!important;gap:8px!important;margin-bottom:13px!important}
  .daily-chest-heading h1{font-size:clamp(37px,11vw,48px)!important;letter-spacing:-2px!important}
  .chest-reset-timer{margin:0!important;width:100%!important}
  .chest-reset-timer.daily-reset-timer,.daily-chest-heading .daily-reset-timer{width:100%!important}
  .daily-chest-card{padding:17px 12px 20px!important;border-radius:20px!important}
  .daily-chest-art{width:100%!important;height:205px!important;margin:0 auto!important}
  .treasure-chest{transform:scale(.78) rotateX(2deg)!important;transform-origin:center center!important;margin-top:14px!important}
  .daily-chest-copy h2{font-size:23px!important}
  .daily-chest-copy p{font-size:11px!important;line-height:1.45!important}
  .daily-chest-progress{width:94%!important;margin-top:18px!important}
  .daily-chest-open{width:min(100%,300px)!important;min-width:0!important}
  .daily-chest-reel-panel{margin-top:19px!important}
  .daily-chest-reel-window{height:150px!important;border-radius:14px!important}
  .daily-reel-item{flex-basis:122px!important;padding:7px!important}
  .daily-reward-avatar,.daily-reward-color{width:92px!important;height:92px!important;border-radius:18px!important}
  .daily-reward-avatar.compact,.daily-reward-color.compact{width:62px!important;height:62px!important}
  .daily-reward-card,.daily-reward-complete{gap:13px!important;padding:15px!important;border-radius:15px!important}
  .daily-reward-card h3,.daily-reward-complete h3{font-size:19px!important}

  /* Dialogs act like mobile sheets rather than squeezed desktop modals. */
  dialog.dialog[open],dialog.patch-notes-dialog[open]{position:fixed!important;inset:auto 8px calc(8px + env(safe-area-inset-bottom)) 8px!important;margin:0!important;width:auto!important;max-width:none!important;max-height:calc(100dvh - 16px - env(safe-area-inset-top) - env(safe-area-inset-bottom))!important;padding:24px 18px 18px!important;border-radius:20px!important;overscroll-behavior:contain}
  .dialog-close{position:sticky!important;float:right;top:0!important;right:0!important;z-index:3;width:42px!important;height:42px!important;margin:-13px -8px 0 0!important;font-size:27px!important}
  .dialog h2{font-size:27px!important}
  .dialog>p,.rule p{font-size:11px!important;line-height:1.6!important}
  .rule{gap:11px!important;margin:17px 0!important}
  .rule>span{width:30px!important;height:30px!important}
  .category-wave{padding:11px!important}
  .result-score{font-size:76px!important;letter-spacing:-4px!important}
  .result-rank{gap:18px!important}
  .auth-tabs button{min-height:42px!important}
  input:not([type=checkbox]),select,textarea{font-size:16px!important} /* prevents iOS zoom */
  .achievement-toast-stack{top:calc(var(--mobile-header) + env(safe-area-inset-top) + 8px)!important;right:8px!important;width:calc(100vw - 16px)!important}
  .achievement-unlock-toast{padding:11px!important}

  /* Standalone admin fallback remains usable on phones too. */
  .admin-main{padding:20px var(--mobile-gutter) 48px!important}
  .admin-nav{display:flex!important;flex-wrap:nowrap!important;overflow-x:auto!important;gap:6px!important;padding-bottom:5px!important;scrollbar-width:none}
  .admin-nav::-webkit-scrollbar{display:none}
  .admin-nav button{flex:0 0 auto!important;min-height:40px!important}
  .admin-table-wrap{margin:0 -4px!important;padding-bottom:5px!important}
  .admin-table{min-width:540px!important}
}

@media(max-width:430px){
  :root{--mobile-gutter:11px}
  .site-header .brand strong{font-size:11px!important;letter-spacing:1.25px!important}
  .site-header .profile-chip{max-width:120px}
  .site-header .profile-chip .trainer-name,.site-header .profile-chip>span:not(.trainer-avatar):not(.trainer-country){max-width:60px}
  .hero-copy h1{font-size:clamp(37px,11vw,46px)!important}
  .hero-art{height:238px!important}
  .preview-card{height:205px!important}
  .preview-card img,.preview-card .image-fallback{width:118px!important;height:118px!important}
  #game-view .matchup{gap:6px!important}
  #game-view .pokemon-card{min-height:244px!important;padding-left:5px!important;padding-right:5px!important}
  #game-view .card-answer{margin-left:-5px!important;margin-right:-5px!important}
  #game-view .pokemon-card h2{font-size:clamp(13px,4.4vw,17px)!important}
  #game-view .pokemon-card img{height:clamp(104px,30vw,135px)!important;max-width:135px!important}
  #game-view .pokemon-card .card-art,#game-view .image-fallback{height:clamp(104px,30vw,135px)!important}
  .avatar-options{grid-template-columns:repeat(2,minmax(0,1fr))!important}
  .profile-stats-grid,.public-profile-view .profile-stats-grid{grid-template-columns:1fr!important}
  .profile-stat-card,.public-profile-view .profile-stat-card{min-height:88px!important;display:grid!important;grid-template-columns:1fr auto!important;align-items:center!important}
  .profile-stat-card strong{font-size:31px!important}
  #account-view .account-panel .profile-hero,#public-profile-view .profile-hero{flex-direction:row!important;align-items:center!important;padding:14px!important;gap:12px!important;min-height:124px!important}
  #account-view .account-panel .trainer-avatar.hero,#public-profile-view .trainer-avatar.hero{width:72px!important;height:72px!important;flex-basis:72px!important}
  #account-view .account-panel .profile-hero h1,#public-profile-view .profile-hero h1{font-size:clamp(24px,7vw,30px)!important;letter-spacing:-1px!important}
  #account-view .account-panel .profile-hero>.profile-avatar-level-wrap+div,#public-profile-view .profile-hero>.profile-avatar-level-wrap+div{min-width:0;flex:1}
  .daily-reward-card,.daily-reward-complete{flex-direction:column!important;text-align:center!important}
  dialog.dialog[open],dialog.patch-notes-dialog[open]{left:6px!important;right:6px!important;bottom:calc(6px + env(safe-area-inset-bottom))!important}
}

@media(max-width:350px){
  .site-header .brand strong{display:none!important}
  .site-header .profile-chip{max-width:116px}
  #game-view .pokemon-card h2{font-size:13px!important}
  #game-view .pokemon-card .type{font-size:5.5px!important;padding:2px 4px!important}
  #game-view .card-answer strong{font-size:16px!important}
}

/* The avatar spans three identity rows; edits share their corresponding row. */
@media(max-width:800px){
  #account-view .account-panel .profile-hero,#public-profile-view .profile-hero{--profile-avatar-size:64px;display:grid!important;grid-template-columns:var(--profile-avatar-size) minmax(0,1fr) auto!important;grid-template-rows:min-content min-content min-content!important;gap:6px 8px!important;padding:12px!important;align-items:center!important;align-content:center!important}
  .profile-hero>.profile-identity{display:contents!important}
  .profile-hero>.profile-avatar-level-wrap{grid-column:1;grid-row:1/4;align-self:center}
  #account-view .account-panel .profile-hero .trainer-avatar.hero,#public-profile-view .profile-hero .trainer-avatar.hero{width:var(--profile-avatar-size)!important;height:var(--profile-avatar-size)!important;flex-basis:var(--profile-avatar-size)!important;border-radius:calc(var(--profile-avatar-size) * .24)!important}
  #account-view .profile-hero .trainer-avatar.profile-frame.hero:not(.frame-none)::after,#public-profile-view .profile-hero .trainer-avatar.profile-frame.hero:not(.frame-none)::after{padding:clamp(2px,calc(var(--profile-avatar-size) * .045),4px)!important}
  .profile-identity>.trainer-title-slot{grid-column:2/4;grid-row:1;position:relative;z-index:1;min-width:0;min-height:18px;margin:0!important;gap:6px;flex-wrap:nowrap}
  .profile-identity .trainer-title-badge{min-width:0;max-width:100%;font-size:10px;letter-spacing:.5px}
  .profile-identity .trainer-title-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .profile-identity .owner-profile-edit-title{flex:none;padding:5px 6px;font-size:8px}
  #account-view .account-panel .profile-hero h1.profile-identity-row,#public-profile-view .profile-hero h1.profile-identity-row{grid-column:2/4;grid-row:2;display:flex;align-items:center;gap:6px;position:relative;z-index:1;min-width:0;margin:0;white-space:nowrap;overflow-wrap:normal;font-size:clamp(18px,5.6vw,26px)!important;letter-spacing:-.7px!important}
  #account-view .profile-hero.owner-profile-editable .profile-identity-row{grid-column:2}
  .profile-identity-row>.trainer-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .profile-hero .profile-identity-row .trainer-country{flex:none;margin-left:0!important;line-height:1}
  .profile-hero .profile-identity-row .trainer-country>.trainer-country-image{width:24px!important;height:17px!important}
  .profile-hero .profile-identity-row .trainer-country>.trainer-country-flag{min-width:24px!important;height:20px!important;font-size:21px!important}
  .profile-hero .profile-identity-row .public-profile-mini-companion{display:block!important;width:32px!important;height:32px!important;flex:0 0 32px!important;padding:0!important;margin:0!important;border-radius:9px;transform:none;overflow:hidden}
  .profile-hero .profile-identity-row .public-profile-mini-companion .leaderboard-mini-sprite-wrap{width:32px!important;height:32px!important}
  .profile-identity-row .leaderboard-mini-shiny{font-size:8px!important;top:1px;right:2px}
  .profile-hero .owner-profile-edit-appearance{grid-column:3;grid-row:2;position:relative!important;right:auto;top:auto;align-self:center;padding:6px;font-size:9px;white-space:nowrap}
  .profile-hero .profile-meta{grid-column:2/4;grid-row:3;display:flex;align-items:center;gap:6px;position:relative;z-index:1;min-width:0;margin:0!important;font-size:10px!important;line-height:1.3}
  .profile-meta>.profile-joined{flex:none;white-space:nowrap}
  .profile-meta>.profile-club{min-width:0;margin:0;gap:4px;white-space:nowrap}
  .profile-meta>.profile-club:before{display:none}
  .profile-meta>.profile-club>span:last-child{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
  .profile-meta .profile-club .club-emblem{width:20px!important;height:20px!important}
}
@media(max-width:380px){
  #account-view .account-panel .profile-hero,#public-profile-view .profile-hero{--profile-avatar-size:56px;grid-template-columns:var(--profile-avatar-size) minmax(0,1fr) auto!important;column-gap:6px!important;padding:10px!important}
  .profile-identity .trainer-title-badge{font-size:9px;letter-spacing:.2px}
  .profile-hero .profile-identity-row{gap:4px!important}
  .profile-hero .profile-identity-row .trainer-country>.trainer-country-image{width:20px!important;height:14px!important}
  .profile-hero .profile-identity-row .public-profile-mini-companion{width:26px!important;height:26px!important;flex-basis:26px!important}
  .profile-hero .profile-identity-row .public-profile-mini-companion .leaderboard-mini-sprite-wrap{width:26px!important;height:26px!important}
  .profile-hero .owner-profile-edit-appearance{padding:5px;font-size:8px}
  .profile-hero .profile-meta{font-size:9px!important;gap:4px}
  .profile-meta .profile-club .club-emblem{width:18px!important;height:18px!important}
}

