/**
 * TALK CARD 180 v2.1.12 — MOBILE + LANDSCAPE
 * Portrait keeps the card tactile. Low-height landscape rearranges play into
 * a compact two-panel table without changing the PICK / SEE / TALK engine.
 */

html {
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-height: 100svh;
}

button,
.mode-card,
.table-card {
  touch-action: manipulation;
}

@media (hover: none) {
  .mode-card:hover,
  .table-card:hover {
    transform: translate(var(--card-x, 0), var(--card-y, 0)) rotate(var(--card-rotate, 0deg));
  }

  .mode-card:hover {
    transform: none;
  }
}

/* Portrait phones */
@media (max-width: 640px) {
  .site-header,
  main {
    width: min(calc(100% - 24px), var(--content));
  }

  .site-header {
    min-height: 68px;
    padding-block: calc(12px + env(safe-area-inset-top)) 10px;
  }

  .brand-button {
    min-height: 44px;
  }

  .screen {
    padding-block: 32px calc(50px + env(safe-area-inset-bottom));
  }

  .deck-select-heading {
    margin-bottom: 24px;
  }

  .deck-select-heading h2 {
    font-size: clamp(31px, 8.4vw, 37px);
    line-height: 1.24;
  }

  .mode-grid {
    gap: 14px;
  }

  .mode-card {
    min-height: 330px;
    padding: 22px;
  }

  .mode-deck-preview {
    width: min(61%, 200px);
    margin: 0 auto 21px;
  }

  .mode-card-copy > strong {
    font-size: clamp(29px, 8vw, 34px);
  }

  .mode-card-copy > span {
    font-size: 13px;
    line-height: 1.55;
  }

  .deck-intro .back-button {
    margin-bottom: 20px;
  }

  .intro-layout {
    gap: 24px;
    padding: 18px 16px 30px;
  }

  .intro-visual {
    min-height: 282px;
  }

  .intro-copy h2 {
    font-size: clamp(35px, 9.5vw, 41px);
  }

  .intro-description {
    margin-top: 13px;
  }

  .intro-copy .button {
    width: min(100%, 280px);
    margin-top: 24px;
  }

  .question-paper {
    min-height: min(500px, calc(100svh - 244px));
  }

  .question-actions,
  .image-actions {
    position: sticky;
    z-index: 12;
    bottom: calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 10px 28px rgba(35, 32, 28, 0.12);
  }

  .card-table-cloth {
    padding-bottom: 22px;
  }

  .table-card {
    min-width: 44px;
    min-height: 62px;
  }

  .image-paper {
    padding: 11px;
  }

  .reveal-image-frame {
    width: min(100%, 520px);
  }

  .play-finish,
  .end-conversation {
    min-height: 44px;
    align-items: center;
    justify-content: center;
  }
}

@media (max-width: 430px) {
  body[data-screen="opening"] .opening {
    padding-top: 12px;
  }

  .opening-cta {
    width: min(100%, 230px);
  }

  .opening-deck--story {
    height: clamp(330px, 87vw, 374px);
  }

  body[data-screen="opening"] .talk-rules {
    margin-top: 8px;
  }

  .table-copy h2 {
    font-size: clamp(28px, 7.7vw, 34px);
  }
}

@media (max-width: 390px) {
  .mode-card {
    min-height: 314px;
    padding: 20px;
  }

  .mode-deck-preview {
    width: min(58%, 188px);
    margin-bottom: 17px;
  }

  .question-paper {
    min-height: min(470px, calc(100svh - 232px));
    padding-inline: 20px;
  }
}

/* Phones rotated to landscape. Width alone cannot identify this layout: the
   low viewport height is the important constraint. */
@media (orientation: landscape) and (min-width: 568px) and (max-height: 600px) {
  :root {
    --landscape-gutter: clamp(14px, 2.8vw, 28px);
  }

  body {
    min-height: 100svh;
  }

  .site-header,
  main {
    width: min(calc(100% - (var(--landscape-gutter) * 2)), var(--content));
  }

  .site-header {
    min-height: 52px;
    padding-block: calc(5px + env(safe-area-inset-top)) 5px;
  }

  .brand-button {
    min-height: 42px;
    gap: 9px;
  }

  .brand-mark {
    width: 32px;
  }

  .brand-button strong {
    font-size: 11px;
  }

  .brand-button small {
    display: none;
  }

  body:not([data-screen="opening"]) .site-header {
    display: none;
  }

  main {
    min-height: calc(100svh - 52px);
  }

  body:not([data-screen="opening"]) main {
    min-height: 100svh;
  }

  .screen {
    padding-block: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-bottom));
  }

  /* Opening: copy and deck share the first viewport; promises remain below. */
  .opening {
    min-height: auto;
    padding: 0;
    grid-template-columns: minmax(190px, 0.75fr) minmax(0, 1.25fr);
    grid-template-rows: minmax(0, calc(100svh - 52px)) auto;
    column-gap: clamp(10px, 2.4vw, 26px);
    row-gap: 0;
  }

  .opening-copy {
    padding: 4px 0 8px 4px;
  }

  .opening-invitation {
    display: none;
  }

  .opening-copy h1 {
    font-size: clamp(37px, 6vw, 54px);
    line-height: 0.9;
  }

  .opening-copy h1 em {
    margin-top: 9px;
  }

  .opening-copy h1 em::before,
  .opening-copy h1 em::after {
    width: 17px;
    margin-right: 7px;
  }

  .opening-copy h1 em::after {
    margin-right: 0;
    margin-left: 2px;
  }

  .opening-lead {
    margin-top: 14px;
    font-size: clamp(14px, 2.05vw, 17px);
    line-height: 1.45;
  }

  .opening-product-copy {
    margin-top: 10px;
    font-size: 6px;
  }

  .opening-cta {
    min-width: 166px;
    min-height: 44px;
    margin-top: 14px;
    padding: 9px 16px;
    font-size: 13px;
  }

  .opening-deck--story {
    width: 100%;
    height: min(320px, calc(100svh - 58px));
    min-height: 0;
    margin: 0;
  }

  .opening-deck--story .opening-card {
    top: 49%;
    width: clamp(102px, 16vw, 145px);
  }

  .opening-deck--story .opening-card--hero {
    --y: -13%;
    width: clamp(122px, 19vw, 168px);
  }

  .opening-card--fan-1 {
    --x: -108%;
    --y: 12%;
    --r: -18deg;
  }

  .opening-card--fan-2 {
    --x: -74%;
    --y: 1%;
    --r: -12deg;
  }

  .opening-card--fan-3 {
    --x: -39%;
    --y: -7%;
    --r: -6deg;
  }

  .opening-card--fan-5 {
    --x: 39%;
    --y: -7%;
    --r: 6deg;
  }

  .opening-card--fan-6 {
    --x: 74%;
    --y: 1%;
    --r: 12deg;
  }

  .opening-card--fan-7 {
    --x: 108%;
    --y: 12%;
    --r: 18deg;
  }

  .opening-orbit--outer {
    width: min(78%, 300px);
  }

  .opening-orbit--inner {
    width: min(56%, 220px);
  }

  .opening-card-title {
    top: 15px;
    font-size: 7px;
  }

  .opening-card-symbol {
    width: 32px;
    font-size: 10px;
  }

  .opening-card--hero .card-seal {
    right: 12px;
    bottom: 13px;
    width: 35px;
    font-size: 8px;
  }

  .opening-card-note {
    bottom: 21px;
    left: 12px;
    font-size: 4px;
  }

  .opening-deck-whisper {
    bottom: 0;
    font-size: 6px;
  }

  body[data-screen="opening"] .talk-rules {
    margin: 0;
    padding: 30px 0 calc(34px + env(safe-area-inset-bottom));
  }

  /* Deck choice */
  .deck-select-v21 {
    height: 100svh;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    gap: 10px;
  }

  .deck-select-heading {
    margin: 0;
  }

  .deck-select-heading h2 {
    font-size: clamp(24px, 3.8vw, 31px);
    line-height: 1.2;
  }

  .mode-grid {
    min-height: 0;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .mode-card {
    min-height: 0;
    height: 100%;
    padding: clamp(13px, 2.2vw, 20px);
    border-radius: 10px;
  }

  .mode-card::after {
    inset: 5px;
    border-radius: 5px;
  }

  .mode-deck-preview {
    width: min(46%, 148px);
    min-height: 0;
    margin: 0 auto 8px;
    aspect-ratio: 4 / 3.2;
  }

  .mode-deck-preview i {
    border-radius: 6px;
  }

  .mode-card-copy {
    gap: 3px;
  }

  .mode-card-copy > strong {
    font-size: clamp(23px, 3.5vw, 30px);
    line-height: 1.1;
  }

  .mode-card-copy > span {
    font-size: 11px;
    line-height: 1.35;
  }

  /* Deck intro */
  .deck-intro {
    position: relative;
    height: 100svh;
  }

  .deck-intro .back-button {
    position: absolute;
    z-index: 8;
    top: max(10px, env(safe-area-inset-top));
    left: 0;
    width: 44px;
    min-height: 44px;
    margin: 0;
    padding: 0;
    overflow: hidden;
    font-size: 0;
    white-space: nowrap;
  }

  .deck-intro .back-button span {
    font-size: 19px;
  }

  .intro-layout {
    min-height: 0;
    height: 100%;
    padding: 12px clamp(30px, 5vw, 54px);
    grid-template-columns: minmax(210px, 0.8fr) minmax(260px, 1.2fr);
    gap: clamp(28px, 6vw, 70px);
    border-radius: 10px;
  }

  .intro-visual {
    width: min(100%, 270px);
    min-height: 0;
    height: min(78svh, 300px);
    margin-inline: auto;
  }

  .intro-visual--closed .intro-back-card {
    border-radius: 7px;
  }

  .intro-copy {
    text-align: left;
  }

  .intro-copy h2 {
    font-size: clamp(30px, 4.8vw, 41px);
  }

  .intro-description {
    max-width: 390px;
    margin: 10px 0 0;
    font-size: 12px;
    line-height: 1.5;
  }

  .intro-copy .button {
    min-height: 46px;
    margin-top: 18px;
  }

  /* Shared in-play chrome */
  .question-play-screen,
  .card-table-screen,
  .image-reveal-screen,
  .closing {
    height: 100svh;
    min-height: 0;
  }

  .play-header {
    min-height: 40px;
    margin: 0;
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .play-header > .text-button {
    width: auto;
    min-height: 40px;
    padding: 0 8px 0 0;
    overflow: visible;
    font-size: 11px;
  }

  .play-header > .text-button span {
    font-size: 15px;
  }

  .play-progress {
    font-size: 12px;
  }

  /* Question: card left, only the two decisions right. */
  .question-play-screen {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(156px, 22vw);
    grid-template-rows: 40px minmax(0, 1fr) 44px;
    grid-template-areas:
      "play-header play-header"
      "question-card question-actions"
      "question-card question-finish";
    gap: 8px clamp(10px, 2vw, 20px);
  }

  .question-play-screen .play-header {
    grid-area: play-header;
  }

  .question-stage {
    grid-area: question-card;
    min-height: 0;
    display: flex;
  }

  .question-paper {
    width: 100%;
    min-height: 0;
    height: 100%;
    padding: clamp(24px, 4vw, 44px);
    border-radius: 9px;
  }

  .question-paper::after {
    border-radius: 5px;
  }

  .question-paper h3 {
    margin: 0;
    font-size: clamp(22px, 4vw, 36px);
    line-height: 1.42;
  }

  .question-actions {
    position: static;
    grid-area: question-actions;
    align-self: end;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .question-actions .button {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    font-size: 12px;
  }

  .question-actions > :first-child,
  .question-actions > :last-child {
    width: 100%;
    min-width: 0;
  }

  .question-play-screen .play-finish {
    grid-area: question-finish;
    min-height: 44px;
    margin: 0;
    align-self: end;
    justify-content: center;
    font-size: 11px;
  }

  /* Image table: 15 backs become a two-row hand. */
  .card-table-screen {
    display: grid;
    grid-template-rows: 40px auto minmax(0, 1fr) 44px;
    gap: 5px;
  }

  .table-copy {
    margin: 0;
  }

  .table-copy h2 {
    font-size: clamp(21px, 3.4vw, 28px);
    line-height: 1.15;
  }

  .card-table-cloth {
    min-height: 0;
    margin: 0;
    padding: clamp(8px, 1.8vh, 12px) clamp(8px, 1.5vw, 14px);
    display: flex;
    align-items: center;
    border-radius: 10px;
  }

  .card-table {
    width: 100%;
    max-width: none;
    grid-template-columns: repeat(8, minmax(44px, 1fr));
    gap: clamp(4px, 0.8vw, 8px);
  }

  .table-card {
    min-width: 44px;
    min-height: 44px;
    border-radius: 6px;
  }

  .table-card-inner {
    padding: 5px;
  }

  .table-card-inner::after {
    inset: 3px;
    border-radius: 3px;
  }

  .table-card-motif {
    top: 5px;
    right: 5px;
    width: clamp(19px, 3.1vw, 27px);
  }

  .table-card-motif::before {
    font-size: 6px;
  }

  .table-card-number {
    right: 5px;
    bottom: 5px;
    min-width: 19px;
    padding: 2px 3px;
    font-size: 7px;
  }

  .table-actions {
    min-height: 44px;
    margin: 0;
  }

  .end-conversation {
    min-height: 44px;
    font-size: 11px;
  }

  /* Image reveal: the image owns the left panel. */
  .image-reveal-screen {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(170px, 23vw);
    grid-template-rows: 40px minmax(0, 1fr) 44px;
    grid-template-areas:
      "image-header image-header"
      "image-stage image-actions"
      "image-stage image-finish";
    gap: 8px clamp(12px, 2.4vw, 24px);
  }

  .image-reveal-screen .play-header {
    grid-area: image-header;
  }

  .image-reveal-stage {
    grid-area: image-stage;
    min-height: 0;
    display: flex;
    justify-content: center;
  }

  .image-paper {
    width: fit-content;
    max-width: 100%;
    min-height: 0;
    height: 100%;
    padding: 7px;
    border-radius: 9px;
  }

  .image-paper::after {
    inset: 4px;
    border-radius: 5px;
  }

  .reveal-image-frame {
    width: auto;
    height: 100%;
    aspect-ratio: 1122 / 1402;
  }

  .reveal-image-frame img {
    width: auto;
    max-width: 100%;
    height: 100%;
    border-radius: 5px;
    object-fit: contain;
  }

  .image-actions {
    position: static;
    grid-area: image-actions;
    align-self: end;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
  }

  .image-actions > :last-child {
    width: 100%;
    min-width: 0;
    min-height: 48px;
    padding-inline: 12px;
    font-size: 12px;
  }

  .image-reveal-screen .play-finish {
    grid-area: image-finish;
    min-height: 44px;
    margin: 0;
    align-self: end;
    justify-content: center;
    font-size: 11px;
  }

  /* Closing */
  .closing {
    display: grid;
    place-items: center;
  }

  .closing-card {
    width: min(100%, 760px);
    min-height: 0;
    padding: clamp(22px, 4vw, 38px);
    border-radius: 9px;
  }

  .closing-card h2 {
    font-size: clamp(27px, 4.5vw, 38px);
    line-height: 1.25;
  }

  .closing-copy {
    margin-top: 10px;
    font-size: 13px;
  }

  .closing-actions {
    margin-top: 20px;
    gap: 8px;
  }

  .closing-actions .button,
  .closing-actions .text-button {
    min-height: 44px;
    padding: 9px 14px;
    font-size: 12px;
  }
}

/* Very short landscape phones (for example 568 × 320). */
@media (orientation: landscape) and (min-width: 568px) and (max-height: 360px) {
  .opening-copy h1 {
    font-size: clamp(34px, 5.5vw, 44px);
  }

  .opening-lead {
    margin-top: 10px;
    font-size: 13px;
  }

  .opening-product-copy {
    display: none;
  }

  .opening-cta {
    margin-top: 11px;
  }

  .opening-deck--story {
    height: calc(100svh - 54px);
  }

  .deck-select-v21 {
    gap: 6px;
  }

  .mode-deck-preview {
    width: min(39%, 118px);
    margin-bottom: 5px;
  }

  .mode-card-copy > span {
    display: none;
  }

  .intro-layout {
    padding-block: 8px;
  }

  .intro-visual {
    height: min(76svh, 245px);
  }

  .question-play-screen,
  .image-reveal-screen {
    grid-template-rows: 36px minmax(0, 1fr) 42px;
  }

  .play-header {
    min-height: 36px;
  }

  .question-paper h3 {
    font-size: clamp(20px, 3.5vw, 28px);
  }

  .card-table-screen {
    grid-template-rows: 36px auto minmax(0, 1fr) 40px;
    gap: 3px;
  }

  .table-copy h2 {
    font-size: 20px;
  }

  .card-table-cloth {
    padding-block: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .opening-deck--story .opening-card,
  .question-paper.is-entering,
  .image-paper.is-entering {
    animation-duration: 0.01ms !important;
    animation-delay: 0ms !important;
  }
}
