/* A separate mobile composition, rather than a scaled desktop dashboard. */
.mobile-header,
.mobile-nav,
.mobile-only {
  display: none;
}
@media (max-width: 700px), (max-width: 950px) and (max-height: 500px) {
  :root {
    --mobile-top: calc(64px + env(safe-area-inset-top, 0px));
    --mobile-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }
  body,
  body.play-page,
  body.battle-page {
    font-size: 15px;
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    overflow-x: clip;
    padding-bottom: var(--mobile-bottom);
    -webkit-text-size-adjust: 100%;
  }
  body .sidebar,
  body .topbar,
  body .page-footer {
    display: none;
  }
  body .workspace,
  body.play-page .workspace,
  body.battle-page .workspace {
    margin: 0;
    width: 100%;
    height: auto;
    min-height: 0;
    display: block;
  }
  body main,
  body.play-page main,
  body.battle-page main {
    padding: 20px 16px 24px;
    max-width: 600px;
    width: 100%;
    display: block;
    margin: 0 auto;
  }
  .mobile-only {
    display: block;
  }
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    height: var(--mobile-top);
    padding: env(safe-area-inset-top, 0px) max(16px, env(safe-area-inset-right, 0px)) 0
      max(16px, env(safe-area-inset-left, 0px));
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--website-surface-21-23-21-0_9607843137254902, #151715f5);
    border-bottom: 1px solid var(--website-line-51-56-45-0_5019607843137255, #33382d80);
    backdrop-filter: blur(18px);
  }
  .mobile-brand {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 2px;
    min-height: 44px;
  }
  .mobile-brand img {
    display: block;
    width: 104px;
    height: auto;
  }
  .mobile-brand small {
    display: block;
    font: 10px/1 var(--body);
    color: var(--muted);
  }
  .mobile-header-actions {
    display: flex;
    align-items: center;
    gap: 4px;
  }
  #mobile-help,
  #mobile-profile {
    background: transparent;
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
    padding: 5px;
    color: var(--muted);
  }
  #mobile-help {
    font-size: 19px;
  }
  #mobile-profile .avatar {
    width: 32px;
    height: 32px;
    font-size: 17px;
  }
  .mobile-nav {
    position: fixed;
    inset: auto 0 0;
    z-index: 20;
    height: var(--mobile-bottom);
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    padding: 6px max(8px, env(safe-area-inset-right, 0px))
      calc(6px + env(safe-area-inset-bottom, 0px)) max(8px, env(safe-area-inset-left, 0px));
    background: var(--website-surface-25-29-23-0_9686274509803922, #191d17f7);
    border-top: 1px solid var(--website-line-58-67-49-1, #3a4331);
    backdrop-filter: blur(20px);
  }
  .mobile-nav a,
  .mobile-nav button {
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 5px;
    background: transparent;
    border-radius: 13px;
    color: var(--website-ink-152-162-141-1, #98a28d);
    font-size: 11px;
    font-weight: 550;
    padding: 5px 2px;
    text-align: center;
    line-height: 1.1;
    position: relative;
  }
  .mobile-nav svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .mobile-nav .active {
    color: var(--lime);
    background: var(--website-surface-211-245-154-0_050980392156862744, #d3f59a0d);
  }
  .mobile-nav .active:before {
    content: '';
    position: absolute;
    top: 0;
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--lime);
  }
  .mobile-keyboard-open .mobile-nav {
    display: none;
  }
  .mobile-keyboard-open {
    --mobile-bottom: 0px;
  }
  button,
  a {
    touch-action: manipulation;
  }
  input,
  textarea,
  select {
    font-size: 16px !important;
  }
  button:disabled {
    cursor: default;
  }
  .flip-button:hover {
    transform: none;
  }
  .icon-button {
    width: 44px;
    height: 44px;
    min-width: 44px;
  }
  .segmented {
    padding: 4px;
    border-radius: 12px;
  }
  .segmented button {
    min-height: 44px;
    font-size: 13px;
    padding: 9px 12px;
    flex: 1;
    border-radius: 8px;
  }
  .outline-button,
  .quiet-button {
    min-height: 44px;
    font-size: 13px;
    padding: 10px 14px;
    align-items: center;
  }
  .flip-button {
    min-height: 52px;
    font-size: 15px;
    border-radius: 12px;
  }
  .section-heading,
  .social-heading {
    margin-bottom: 22px;
  }
  .section-heading h1,
  .social-heading h1 {
    font-size: 29px;
    letter-spacing: -1px;
    line-height: 1.15;
    margin: 9px 0;
  }
  .section-heading p,
  .social-heading p {
    font-size: 14px;
    line-height: 1.6;
  }
  .eyebrow {
    font-size: 10px;
    letter-spacing: 1.2px;
  }
  .tiny-pill {
    font-size: 9px;
    padding: 5px 7px;
    letter-spacing: 0.4px;
  }
  .wide-card,
  .social-panel {
    border-radius: 16px;
    padding: 18px 16px;
  }
  .info-note,
  .social-footnote,
  .subtle {
    font-size: 13px;
    line-height: 1.6;
  }
  .search-label,
  form label {
    font-size: 11px;
  }
  .social-input {
    min-height: 48px;
    font-size: 16px;
  }

  /* Play: streak, coin, and a full-width thumb zone. Details open on demand. */
  body.play-page {
    padding-bottom: var(--mobile-bottom);
  }
  body.play-page .workspace {
    height: calc(100dvh - var(--mobile-top) - var(--mobile-bottom));
    min-height: 600px;
  }
  body.play-page main {
    height: 100%;
    padding: 12px 16px;
  }
  body.play-page #view-play {
    height: 100%;
    display: block;
  }
  body.play-page .page-heading,
  body.play-page .right-column,
  body.play-page .stats-strip,
  body.play-page .game-intro {
    display: none;
  }
  body.play-page .play-layout,
  body.play-page .play-column {
    height: 100%;
    min-height: 0;
    display: block;
  }
  body.play-page .game-card {
    height: 100%;
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    overflow: visible;
  }
  body.play-page .game-card-top {
    flex-shrink: 0;
    min-height: 52px;
    gap: 12px;
  }
  body.play-page .game-card-top .segmented {
    flex: 1;
    max-width: 300px;
    padding: 4px;
  }
  body.play-page .game-card-top .segmented button {
    font-size: 14px;
    min-height: 44px;
    padding: 8px 14px;
  }
  body.play-page .game-card-top .icon-button {
    width: 44px;
    height: 44px;
    background: var(--website-surface-32-38-28-1, #20261c);
    border-radius: 12px;
    border: 1px solid var(--line);
  }
  body.play-page .mute-slash {
    top: 1px;
    left: 20px;
  }
  .mobile-game-summary {
    text-align: center;
    flex-shrink: 0;
    padding-top: 14px;
  }
  #mobile-streak-label {
    display: block;
    font-size: 10px;
    letter-spacing: 2px;
    color: var(--website-ink-169-183-152-1, #a9b798);
  }
  #mobile-streak {
    font-family: var(--display);
    display: block;
    font-size: 58px;
    line-height: 1.05;
    font-weight: 500;
    color: var(--text);
    margin: 4px 0;
  }
  .mobile-run-meta {
    display: flex;
    justify-content: center;
    gap: 16px;
    font-size: 12px;
    color: var(--website-ink-150-163-135-1, #96a387);
  }
  .mobile-run-meta b {
    font-weight: 600;
    color: var(--website-ink-210-221-197-1, #d2ddc5);
  }
  #mobile-play-note {
    font-size: 11px;
    color: var(--lime);
    display: inline-flex;
    border: 1px solid var(--website-line-61-76-48-1, #3d4c30);
    background: var(--website-surface-211-245-154-0_027450980392156862, #d3f59a07);
    padding: 5px 10px;
    border-radius: 20px;
    margin-top: 10px;
  }
  #mobile-play-note.ranked-note {
    color: #edcc94;
    border-color: #6c583d;
    background: #e8b97309;
  }
  body.play-page .coin-stage {
    flex: 1;
    min-height: 140px;
    height: auto;
    width: 100%;
    margin: 0;
    grid-column: auto;
    grid-row: auto;
    container-type: size;
  }
  body.play-page .coin-wrap {
    width: min(224px, 90cqh);
    height: min(224px, 90cqh);
    aspect-ratio: 1;
  }
  body.play-page .coin-emblem {
    font-size: 70px;
  }
  .play-page .coin-side {
    font-size: 12px;
  }
  .play-page .coin-rim-text {
    font-size: 6px;
  }
  body.play-page .orbit-one {
    width: 240px;
    height: 210px;
  }
  .play-page .orbit-two {
    width: 320px;
    height: 175px;
  }
  .play-page .coin-shadow {
    bottom: 8px;
  }
  body.play-page .coin-caption {
    min-height: 44px;
    flex-shrink: 0;
    font-size: 12px;
    gap: 9px;
    align-items: center;
    margin: 0 0 4px;
    flex-wrap: nowrap;
  }
  body.play-page .coin-caption a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--website-ink-194-206-179-1, #c2ceb3);
  }
  body.play-page .game-controls {
    width: 100%;
    display: block;
    flex-shrink: 0;
    padding: 0;
  }
  body.play-page .game-controls .pick-label {
    display: none;
  }
  body.play-page .game-controls .choice-buttons {
    display: flex;
    width: 100%;
    max-width: none;
    gap: 10px;
    margin: 0;
  }
  body.play-page .game-controls .choice {
    min-height: 52px;
    font-size: 16px;
    padding: 12px;
    gap: 9px;
    border-radius: 12px;
  }
  body.play-page .choice-symbol {
    font-size: 22px;
  }
  .play-page .choice-check {
    right: 14px;
    font-size: 12px;
  }
  body.play-page .game-controls > .flip-button {
    width: 100%;
    max-width: none;
    height: 58px;
    font-size: 17px;
    margin: 10px 0 0;
    padding: 14px 16px;
    border-radius: 13px;
  }
  body.play-page .game-controls .result-message {
    height: auto;
    min-height: 38px;
    font-size: 12px;
    line-height: 1.4;
    padding: 7px 8px;
  }
  body.play-page .run-section {
    flex-shrink: 0;
    border: 0;
    padding: 0;
    margin: 0;
  }
  body.play-page .run-header,
  body.play-page .flip-history,
  body.play-page #reset-label {
    display: none;
  }
  body.play-page .run-footer {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    line-height: 1.4;
  }
  body.play-page .run-footer button {
    min-height: 44px;
    padding: 8px;
    font-size: 12px;
    justify-content: center;
    gap: 7px;
    background: var(--website-surface-32-37-29-1, #20251d);
    border: 1px solid var(--website-line-48-59-39-1, #303b27);
    border-radius: 10px;
  }
  body.play-page .run-footer button svg {
    width: 16px;
    height: 16px;
  }

  /* One clear online-player list and meaningful challenge targets. */
  .social-heading > .mock-label {
    font-size: 10px;
    padding: 8px;
  }
  .social-intro-strip {
    border: 0;
    border-radius: 14px;
    margin-bottom: 18px;
    padding: 14px;
    background: var(--website-surface-32-39-27-1, #20271b);
  }
  .social-intro-strip strong {
    font-size: 22px;
  }
  .social-intro-strip > span {
    font-size: 11px;
    line-height: 1.5;
  }
  .social-panel-heading h2 {
    font-size: 20px;
  }
  .count-label {
    font-size: 13px;
  }
  .online-player {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 94px;
    gap: 5px 10px;
    padding: 18px 0;
  }
  .online-player .member-identity {
    grid-column: 1;
    grid-row: 1;
    min-height: 44px;
    gap: 10px;
  }
  .online-player .member-identity strong {
    font-size: 15px;
  }
  .online-player .member-identity small {
    font-size: 11px;
    line-height: 1.4;
    margin-top: 4px;
  }
  .online-player .avatar-frame.large-frame .avatar {
    width: 40px;
    height: 40px;
    font-size: 19px;
  }
  .online-player-meta {
    display: flex;
    grid-column: 1;
    grid-row: 2;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 10px;
    text-align: left;
    padding-left: 50px;
    align-items: center;
  }
  .presence,
  .player-record {
    font-size: 11px;
  }
  .player-record small {
    display: none;
  }
  .online-player > .outline-button {
    grid-column: 2;
    grid-row: 1/3;
    min-height: 46px;
    font-size: 12px;
    padding: 10px;
    justify-content: center;
  }
  .demo-panel p,
  .demo-panel > small {
    font-size: 13px;
  }
  .record-pair span {
    font-size: 11px;
  }
  .history-panel .match-history {
    font-size: 13px;
  }
  .invitation-banner {
    flex-wrap: wrap;
  }
  .invitation-banner strong {
    font-size: 15px;
  }
  .invitation-banner small {
    font-size: 12px;
  }
  .invitation-banner .outline-button {
    min-height: 44px;
    font-size: 13px;
  }

  /* Battles: larger reveal and player panels, calls nearest the thumb. */
  body.battle-page {
    padding-bottom: var(--mobile-bottom);
  }
  body.battle-page main {
    padding: 12px 16px;
  }
  body.battle-page .workspace,
  body.battle-page:not(:has(.arena-voting)) .workspace {
    height: auto;
    display: block;
  }
  body.battle-page #view-battle {
    display: block;
    min-height: 0;
  }
  body.battle-page .arena-heading {
    display: none;
  }
  body.battle-page .arena-layout {
    display: flex;
    min-height: 0;
  }
  body.battle-page .arena-sidebar {
    display: none;
  }
  body.battle-page .arena-card {
    min-height: calc(100dvh - var(--mobile-top) - var(--mobile-bottom) - 24px);
    width: 100%;
    border: 0;
    border-radius: 0;
    background: transparent;
    gap: 10px !important;
    padding: 0 !important;
  }
  body.battle-page .arena-round-header {
    min-height: 30px;
    flex-shrink: 0;
  }
  body.battle-page .round-status {
    font-size: 13px;
    letter-spacing: 0.7px;
  }
  .battle-page .arena-round-header .tiny-pill {
    font-size: 9px;
    padding: 5px;
  }
  body.battle-page .duel-coin-stage {
    min-height: 170px;
    flex: 1;
    grid-template-columns: 1fr 1.35fr 1fr;
  }
  body.battle-page .duel-coin {
    width: 72px;
    height: 72px;
  }
  .battle-page .duel-coin .coin-emblem {
    font-size: 27px;
  }
  .battle-page .duel-coin .coin-side {
    font-size: 5px;
  }
  body.battle-page .central-duel-coin {
    width: 122px;
    height: 122px;
  }
  .battle-page .central-duel-coin .coin-emblem {
    font-size: 47px;
  }
  .battle-page .central-duel-coin .coin-side {
    font-size: 8px;
  }
  body.battle-page .personal-coin-slot,
  body.battle-page .shared-coin-slot {
    gap: 8px;
  }
  body.battle-page .personal-coin-slot > span {
    font-size: 10px;
    max-width: 90px;
  }
  .battle-page .shared-coin-slot .eyebrow {
    font-size: 9px;
    letter-spacing: 0.5px;
  }
  .battle-page .shared-coin-slot > strong {
    font-size: 11px;
  }
  body.battle-page .duel-player-row {
    grid-template-columns: minmax(0, 1fr) 22px minmax(0, 1fr);
  }
  body.battle-page .duel-player {
    padding: 12px 10px;
    grid-template-columns: auto 1fr;
    gap: 8px;
    border-radius: 14px;
  }
  body.battle-page .duel-player > .large-frame .avatar {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }
  body.battle-page .duel-player-name {
    grid-row: 2;
    grid-column: 1/-1;
    padding: 0;
  }
  .battle-page .duel-player-name h2 {
    font-size: 14px;
    margin: 0 0 4px;
  }
  .battle-page .duel-player-name > span {
    font-size: 10px;
  }
  body.battle-page .duel-player-score {
    grid-row: 1;
    grid-column: 2;
  }
  .battle-page .duel-player-score > strong {
    font-size: 30px;
  }
  .battle-page .duel-player-score > span {
    font-size: 8px;
    letter-spacing: 0;
    margin-top: 4px;
  }
  body.battle-page .duel-player-current {
    grid-row: 3;
    font-size: 11px;
    gap: 5px;
    padding-top: 8px;
    line-height: 1.4;
  }
  body.battle-page .round-progression > span {
    width: 28px;
    height: 28px;
    font-size: 11px;
  }
  .battle-page .round-progression > small {
    display: none;
  }
  body.battle-page .arena-message {
    min-height: 38px;
    display: grid;
    place-items: center;
    font-size: 14px;
    padding: 4px;
    line-height: 1.4;
  }
  .battle-page .arena-message.arena-final {
    font-size: 21px;
  }
  body.battle-page .arena-actions {
    gap: 10px;
    flex-direction: column;
  }
  body.battle-page .duel-choice-row {
    gap: 10px;
  }
  .battle-page .duel-choice-row > button {
    min-height: 52px;
    font-size: 16px;
    padding: 12px;
    border-radius: 12px;
  }
  body.battle-page .arena-actions > .flip-button {
    min-height: 56px;
    font-size: 16px;
    padding: 14px;
  }
  .battle-page .arena-actions > .outline-button {
    min-height: 48px;
    font-size: 14px;
  }
  body.battle-page .auto-round-notice {
    min-height: 56px;
    font-size: 13px;
    border-radius: 12px;
  }
  body.battle-page .arena-meta {
    min-height: 44px;
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
  }
  .battle-page .arena-meta > span {
    display: none;
  }
  body.battle-page .arena-meta .quiet-button {
    font-size: 12px;
    min-height: 44px;
    padding: 8px;
  }
  .battle-page .mobile-round-history {
    display: inline-flex;
  }
  body.battle-page .arena-card:has(.arena-voting) {
    min-height: 0;
  }
  .battle-page .arena-card:has(.arena-voting) .duel-coin-stage {
    min-height: 160px;
  }
  body.battle-page .arena-voting {
    padding: 16px 0;
    margin: 0;
  }
  .battle-page .arena-voting h3 {
    font-size: 14px;
  }
  .battle-page .arena-voting .tiny-pill {
    font-size: 8px;
  }
  body.battle-page .vote-tallies > div > strong {
    font-size: 13px;
  }
  .battle-page .vote-numbers {
    font-size: 12px;
  }
  .battle-page .vote-numbers b {
    font-size: 16px;
  }
  body.battle-page .vote-tallies small {
    font-size: 11px;
  }
  .battle-page .your-vote > span {
    font-size: 12px;
  }
  .battle-page .your-vote .quiet-button {
    font-size: 13px;
    justify-content: center;
  }
  body.battle-page .arena-card:has(.arena-voting) .arena-actions {
    position: sticky;
    bottom: var(--mobile-bottom);
    padding: 10px 0;
    background: var(--bg);
    z-index: 2;
  }

  /* Rankings become a readable compact list with deliberate filters. */
  #view-rankings .wide-card {
    padding: 0;
    border: 0;
    background: transparent;
  }
  #view-rankings > .section-heading {
    display: none;
  }
  .mobile-ranking-heading {
    margin-bottom: 18px;
  }
  .mobile-ranking-heading h1 {
    font-size: 29px;
    line-height: 1.2;
    letter-spacing: -1px;
    margin: 0 0 7px;
  }
  .mobile-ranking-heading p {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
  }
  .leaderboard-types {
    margin: 0 0 16px;
    border-radius: 12px;
  }
  .leaderboard-types button {
    min-height: 44px;
    font-size: 13px;
  }
  .leaderboard-controls {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    gap: 8px;
  }
  .leaderboard-controls .segmented {
    width: auto;
    min-width: 0;
    flex: 1;
  }
  .leaderboard-controls .segmented[aria-label='Rankings audience'] {
    flex: 0 0 138px;
  }
  .leaderboard-controls .segmented button {
    font-size: 12px;
    padding: 7px 5px;
    min-width: 0;
  }
  .ranking-heading h2 {
    font-size: 19px;
  }
  .ranking-heading .tiny-pill {
    display: none;
  }
  .period-range {
    font-size: 12px;
  }
  #view-rankings .wide-card > .subtle {
    display: none;
  }
  .table-scroll {
    overflow: visible;
  }
  #view-rankings table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
  }
  #view-rankings th {
    font-size: 10px;
    letter-spacing: 0.3px;
    padding: 14px 5px;
  }
  #view-rankings td {
    padding: 9px 5px;
    font-size: 13px;
    height: 64px;
  }
  #view-rankings th:first-child,
  #view-rankings td:first-child {
    width: 36px;
  }
  #view-rankings th:nth-child(3),
  #view-rankings td:nth-child(3),
  #view-rankings th:nth-child(4),
  #view-rankings td:nth-child(4) {
    width: 60px;
    text-align: right;
  }
  #view-rankings th:nth-child(5),
  #view-rankings td:nth-child(5) {
    display: none;
  }
  #view-rankings:has([data-board='ranked'][aria-pressed='true']) th:nth-child(4),
  #view-rankings:has([data-board='ranked'][aria-pressed='true']) td:nth-child(4) {
    display: none;
  }
  #view-rankings:has([data-board='ranked'][aria-pressed='true']) th:nth-child(3),
  #view-rankings:has([data-board='ranked'][aria-pressed='true']) td:nth-child(3) {
    width: 94px;
  }
  #view-rankings .table-name {
    width: 100%;
    min-height: 44px;
    gap: 8px;
    font-size: 14px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  #view-rankings .table-name .avatar {
    width: 30px;
    height: 30px;
    font-size: 14px;
  }
  #view-rankings .table-name small {
    display: none;
  }
  #view-rankings td:nth-child(3) {
    font-size: 20px;
  }
  .leaderboard-types ~ .wide-card #rank-share {
    width: 100%;
    justify-content: center;
    margin-top: 16px;
  }

  /* Chat is a conversation viewport, with channels in a sheet. */
  body:has(#view-chat:not([hidden])) {
    padding-bottom: 0;
  }
  body:has(#view-chat:not([hidden])) .workspace {
    height: calc(var(--mobile-visible-height, 100dvh) - var(--mobile-top) - var(--mobile-bottom));
  }
  body:has(#view-chat:not([hidden])) main {
    height: 100%;
    padding: 0;
  }
  #view-chat {
    height: 100%;
  }
  #view-chat > .social-heading,
  #view-chat .chat-channel-panel {
    display: none;
  }
  .chat-layout {
    display: block;
    height: 100%;
  }
  .chat-main.social-panel {
    height: 100%;
    min-height: 0;
    display: flex;
    flex-direction: column;
    border: 0;
    border-radius: 0;
    padding: 0;
    background: transparent;
  }
  .chat-room-header {
    flex-shrink: 0;
    min-height: 78px;
    padding: 14px 16px;
    gap: 8px;
  }
  .chat-room-header h2 {
    font-size: 18px;
    line-height: 1.4;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .chat-room-header .eyebrow {
    font-size: 9px;
  }
  .chat-room-header > [data-social-action='mock-message'] {
    display: none;
  }
  .mobile-channel-switch {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    background: var(--website-surface-37-48-30-1, #25301e);
    color: var(--lime);
    border: 1px solid var(--website-line-72-92-53-1, #485c35);
    border-radius: 10px;
    min-height: 44px;
    padding: 8px 10px;
    font-size: 11px;
    flex-shrink: 0;
  }
  .mobile-channel-switch svg {
    width: 18px;
    height: 18px;
  }
  .chat-messages {
    flex: 1;
    min-height: 0;
    overflow: auto;
    padding: 16px;
    overscroll-behavior: contain;
  }
  .chat-message {
    gap: 10px;
    margin-bottom: 22px;
  }
  .chat-message strong {
    font-size: 13px;
  }
  .chat-message p {
    font-size: 15px;
    line-height: 1.55;
    margin-top: 7px;
  }
  .chat-message time {
    font-size: 10px;
  }
  .chat-message .avatar {
    width: 32px;
    height: 32px;
    font-size: 15px;
  }
  .message-tag {
    font-size: 8px;
  }
  .chat-composer {
    flex-shrink: 0;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom, 0px));
    display: flex;
    gap: 8px;
    align-items: flex-end;
    background: var(--website-surface-28-33-24-1, #1c2118);
    border-top: 1px solid var(--line);
  }
  .chat-composer textarea {
    height: 50px;
    min-height: 50px;
    max-height: 120px;
    resize: vertical;
    padding: 13px 12px;
    border-radius: 12px;
    flex: 1;
    min-width: 0;
    line-height: 1.4;
  }
  .chat-composer > .flip-button {
    min-height: 50px;
    height: 50px;
    padding: 10px 15px;
    font-size: 14px;
    border-radius: 12px;
  }
  .chat-composer > small {
    display: none;
  }
  .mobile-channel-list .chat-channel {
    min-height: 56px;
    width: 100%;
    font-size: 15px;
    padding: 13px 12px;
    border-radius: 12px;
    margin: 5px 0;
  }
  .mobile-channel-list .chat-channel small {
    font-size: 11px;
  }
  .mobile-channel-list .chat-friends-heading a {
    min-width: 44px;
    min-height: 44px;
    display: grid;
    place-items: center;
  }
  .mobile-channel-list .chat-local-note {
    font-size: 12px;
  }

  /* Secondary routes and sheets use normal mobile reading sizes. */
  .guild-home-identity h2 {
    font-size: 25px;
  }
  .guild-home-identity p,
  .guild-vote-note > p {
    font-size: 13px;
  }
  .guild-home-identity .eyebrow {
    font-size: 10px;
  }
  .guild-home-actions .outline-button {
    font-size: 12px;
    min-height: 48px;
  }
  .guild-member-preview > span:last-child {
    font-size: 11px;
  }
  .guild-directory-card h2 {
    font-size: 25px;
  }
  .guild-directory-card > p {
    font-size: 14px;
  }
  .guild-card-stats {
    font-size: 12px;
  }
  .directory-heading .text-link {
    font-size: 12px;
    min-height: 44px;
  }
  .coin-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .coin-card {
    padding: 16px 12px;
  }
  .coin-card h2 {
    font-size: 17px;
  }
  .coin-card p {
    font-size: 12px;
  }
  .coin-card button {
    min-height: 44px;
    font-size: 13px;
    width: 100%;
  }
  .friend-search-card .search-input-row {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  .search-input-row input {
    width: 100%;
    min-height: 48px;
  }
  .search-input-row button {
    width: 100%;
    min-height: 48px;
  }
  .friend-row {
    min-height: 72px;
  }
  .friend-row strong {
    font-size: 15px;
  }
  .friend-row small {
    font-size: 11px;
  }
  .friend-row button {
    min-height: 44px;
  }
  .friend-list-card {
    padding: 16px;
  }
  .member-row .member-identity {
    min-height: 48px;
    gap: 9px;
  }
  .member-row .member-identity strong {
    font-size: 14px;
  }
  .member-row .member-identity small {
    font-size: 11px;
    line-height: 1.4;
  }
  .member-row .member-identity .avatar {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }
  .remove-friend,
  .added-button {
    min-height: 44px;
    min-width: 54px;
    padding: 10px 7px;
    font-size: 12px;
  }
  .member-row .outline-button {
    min-height: 44px;
    font-size: 12px;
  }
  .shop-tabs {
    display: flex;
    width: 100%;
  }
  .shop-tabs button {
    font-size: 12px;
    min-height: 44px;
    padding: 8px;
  }
  .shop-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }
  .shop-card {
    padding: 14px 10px;
  }
  .shop-card h3 {
    font-size: 15px;
  }
  .shop-card p {
    font-size: 12px;
  }
  .shop-card button {
    min-height: 44px;
    font-size: 12px;
  }
  .shop-item h2 {
    font-size: 17px;
  }
  .shop-item p {
    font-size: 12px;
    line-height: 1.6;
  }
  .shop-item-actions .preview-button,
  .shop-item-actions .outline-button {
    min-height: 44px;
    font-size: 12px;
    padding: 9px 6px;
  }
  .shop-item-meta .eyebrow,
  .unlocked-label {
    font-size: 9px;
    letter-spacing: 0.5px;
  }
  .shop-preview {
    position: static;
    margin-top: 20px;
  }
  .dev-access-note p {
    font-size: 12px;
  }
  .achievement-grid {
    grid-template-columns: 1fr;
  }
  .achievement-tile p {
    font-size: 13px;
  }
  dialog#modal,
  dialog#mobile-menu {
    max-height: calc(var(--mobile-visible-height, 100dvh) - env(safe-area-inset-top, 0px) - 16px);
    width: 100%;
    max-width: 600px;
    inset: auto 0 0;
    margin: 0 auto;
    padding: 22px 20px calc(24px + env(safe-area-inset-bottom, 0px));
    border: 1px solid var(--website-line-67-82-53-1, #435235);
    border-bottom: 0;
    border-radius: 24px 24px 0 0;
    overflow: auto;
    background: var(--website-surface-28-34-24-1, #1c2218);
    overscroll-behavior: contain;
  }
  dialog::backdrop {
    background: var(--website-surface-8-11-8-0_7215686274509804, #080b08b8);
    backdrop-filter: blur(4px);
  }
  .modal-top {
    margin-bottom: 18px;
  }
  .modal-top button {
    min-height: 44px;
    min-width: 44px;
  }
  #modal h2 {
    font-size: 25px;
  }
  #modal p,
  #modal li {
    font-size: 14px;
    line-height: 1.6;
  }
  #modal .profile-edit label {
    font-size: 11px;
  }
  #modal .profile-edit-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }
  #modal .color-option {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
  }
  .mobile-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--website-surface-99-116-79-1, #63744f);
    border-radius: 4px;
    margin: -11px auto 18px;
  }
  .mobile-menu-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 18px;
  }
  .mobile-menu-heading h2 {
    font-size: 25px;
    margin: 0;
    font-weight: 500;
    font-family: var(--display);
  }
  .mobile-menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }
  .mobile-menu-grid a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 64px;
    padding: 14px 12px;
    background: var(--website-surface-40-48-33-1, #283021);
    border: 1px solid var(--website-line-57-73-44-1, #39492c);
    border-radius: 14px;
    font-size: 14px;
  }
  .mobile-menu-grid svg {
    width: 23px;
    height: 23px;
    color: var(--lime);
  }
  #mobile-menu-profile {
    width: 100%;
    margin-top: 18px;
    justify-content: center;
    min-height: 48px;
  }
  .mobile-detail-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 20px 0;
  }
  .mobile-detail-stats strong {
    display: block;
    font-size: 32px;
    color: var(--lime);
    font-family: var(--display);
  }
  .mobile-detail-stats span {
    font-size: 11px;
    color: var(--muted);
  }
  .mobile-history-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
  }
  .mobile-history-grid .flip-slot {
    height: 44px;
    font-size: 16px;
  }
  .toast {
    bottom: calc(var(--mobile-bottom) + 12px);
    max-width: calc(100vw - 32px);
    font-size: 13px;
    line-height: 1.5;
    padding: 13px 18px;
    z-index: 30;
  }
}
@media (max-width: 700px) and (max-height: 760px) {
  body.play-page .workspace {
    min-height: 528px;
  }
  body.play-page main {
    padding-top: 8px;
    padding-bottom: 8px;
  }
  .mobile-game-summary {
    padding-top: 4px;
  }
  #mobile-streak {
    font-size: 34px;
    margin: 2px 0;
  }
  #mobile-play-note {
    margin-top: 4px;
    padding: 0;
    border: 0;
    background: none;
    line-height: 16px;
  }
  body.play-page .coin-wrap {
    width: 128px;
    height: 128px;
  }
  body.play-page .coin-stage {
    min-height: 128px;
  }
  body.play-page .coin-emblem {
    font-size: 51px;
  }
  body.play-page .orbit-one {
    width: 210px;
    height: 160px;
  }
  body.play-page .orbit-two {
    width: 265px;
    height: 130px;
  }
  body.play-page .coin-caption {
    margin-bottom: 0;
  }
  body.play-page .game-controls .result-message {
    min-height: 32px;
    font-size: 11px;
  }
  body.battle-page .duel-coin-stage {
    min-height: 130px;
  }
  .battle-page .duel-player {
    padding: 9px 8px;
  }
  .battle-page .duel-player-current {
    flex-direction: row;
    flex-wrap: wrap;
  }
}
@media (min-width: 701px) and (min-height: 501px), (min-width: 951px) {
  #mobile-history {
    display: none;
  }
}
@media (min-width: 701px) and (max-width: 950px) and (max-height: 500px) {
  body.play-page .workspace {
    min-height: 266px;
  }
  body.play-page main {
    max-width: none;
    padding: 8px 24px;
  }
  body.play-page .game-card {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    grid-template-rows: 54px minmax(0, 1fr) 44px;
    gap: 0 24px;
  }
  body.play-page .game-card-top {
    grid-column: 2;
    grid-row: 1;
    min-height: 0;
  }
  .mobile-game-summary {
    grid-column: 1;
    grid-row: 1;
    padding: 0;
    align-self: center;
  }
  #mobile-streak {
    font-size: 30px;
    margin: 0;
  }
  #mobile-streak-label {
    font-size: 10px;
  }
  .mobile-run-meta,
  #mobile-play-note {
    display: none;
  }
  body.play-page .coin-stage {
    grid-column: 1;
    grid-row: 2;
    min-height: 0;
    height: 100%;
  }
  body.play-page .coin-wrap {
    width: min(140px, 85cqh);
    height: min(140px, 85cqh);
  }
  body.play-page .coin-emblem {
    font-size: 49px;
  }
  body.play-page .orbit-one {
    width: 190px;
    height: 125px;
  }
  body.play-page .orbit-two {
    width: 245px;
    height: 140px;
  }
  body.play-page .coin-caption {
    grid-column: 1;
    grid-row: 3;
    margin: 0;
    font-size: 12px;
  }
  body.play-page .coin-caption > span {
    display: none;
  }
  body.play-page .game-controls {
    grid-column: 2;
    grid-row: 2;
    align-self: center;
  }
  body.play-page .game-controls .result-message {
    min-height: 32px;
  }
  body.play-page .run-section {
    grid-column: 2;
    grid-row: 3;
  }
  body.battle-page main {
    max-width: 750px;
  }
  .battle-page .arena-card {
    min-height: 650px;
  }
}
@media (max-width: 360px) {
  .mobile-nav a,
  .mobile-nav button {
    font-size: 10px;
  }
  .mobile-nav svg {
    width: 22px;
  }
  .mobile-header {
    padding-left: 12px;
    padding-right: 12px;
  }
  body main {
    padding-left: 12px;
    padding-right: 12px;
  }
  .mobile-menu-grid {
    gap: 8px;
  }
  .mobile-menu-grid a {
    font-size: 13px;
    padding: 10px;
  }
}

/* Keep mobile Friends within the viewport as framed identities grow. */
@media (max-width: 700px) {
  #view-friends .friends-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  #view-friends .friends-layout > * {
    min-width: 0;
  }
  #view-friends .member-identity {
    flex: 1;
  }
  #view-friends .member-identity > span:last-child {
    min-width: 0;
  }
  #view-friends .member-identity .styled-name {
    max-width: 100%;
    flex-wrap: wrap;
    row-gap: 4px;
  }
}
