/* Browser-based 29. Designed for 360 CSS pixel portrait phones upwards, with
   visible focus, 44px touch targets and no reliance on colour alone. */

:root {
  --bg: #f5f1e9;
  --surface: #fffdf8;
  --surface-alt: #ece7dc;
  --ink: #263b31;
  --muted: #606b61;
  --line: #d7d9cd;
  --accent: #225f46;
  --accent-ink: #ffffff;
  --danger: #8c2f1f;
  --warning: #7a5200;
  --focus: #0b57d0;
  --radius: 12px;
  --touch: 44px;
}


* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

body {
  min-height: 100dvh;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  color: var(--ink);
  padding: 0.75rem 1rem;
  z-index: 20;
}

.skip-link:focus {
  left: 0;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.screen {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h1 {
  font-size: 1.6rem;
}

h2 {
  font-size: 1.25rem;
}

p {
  margin: 0 0 0.75rem;
}

.lede {
  color: var(--muted);
}

.card-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

form .field {
  display: block;
  margin-bottom: 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.hint {
  color: var(--muted);
  font-size: 0.875rem;
  margin: 0.25rem 0 0;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  min-height: var(--touch);
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

button {
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
}

button.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

button.danger {
  color: var(--danger);
}

button[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.notice {
  border-left: 4px solid var(--accent);
  background: var(--surface);
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.notice.error {
  border-left-color: var(--danger);
}

.notice.warning {
  border-left-color: var(--warning);
}

.seat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.5rem;
}

@media (min-width: 40rem) {
  .seat-list {
    grid-template-columns: 1fr 1fr;
  }
}

.seat-list li {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.seat-list li.is-you {
  border-color: var(--accent);
  border-width: 2px;
}

.tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  color: var(--muted);
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  padding: 0;
  margin: 0 0 1rem;
  list-style: none;
}

.status-line li {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  font-size: 0.9rem;
}

.status-line strong {
  font-weight: 700;
}

/* Table: local player at the bottom, partner opposite, opponents to the sides. */
.table {
  display: grid;
  grid-template-areas:
    "partner partner partner"
    "left trick right"
    "you you you";
  grid-template-columns: 1fr minmax(8rem, 1.4fr) 1fr;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.seat-box {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem;
  font-size: 0.9rem;
  text-align: center;
}

.seat-box.partner {
  grid-area: partner;
}
.seat-box.left {
  grid-area: left;
}
.seat-box.right {
  grid-area: right;
}
.seat-box.you {
  grid-area: you;
}

.seat-box .seat-name {
  font-weight: 700;
  display: block;
  overflow-wrap: anywhere;
}

.seat-box.turn {
  border-color: var(--accent);
  border-width: 3px;
}

.seat-box .flags {
  color: var(--muted);
  font-size: 0.8rem;
}

.trick {
  grid-area: trick;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 6rem;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 0.5rem;
}

.card {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 2.75rem;
  min-height: var(--touch);
  padding: 0.35rem 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.card .rank {
  font-weight: 700;
  font-size: 1.05rem;
}

.card .suit {
  font-size: 1rem;
}

.card.played {
  background: var(--surface-alt);
}

.hand {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0;
  margin: 0 0 0.75rem;
  list-style: none;
}

button.card {
  cursor: pointer;
}

button.card[aria-pressed="true"] {
  border-color: var(--accent);
  border-width: 3px;
  transform: translateY(-4px);
}

button.card[disabled] {
  opacity: 0.4;
}

.reserved {
  border-style: dashed;
  border-width: 2px;
}

.bid-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

table.scores {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1rem;
}

table.scores th,
table.scores td {
  border: 1px solid var(--line);
  padding: 0.4rem 0.6rem;
  text-align: left;
  font-size: 0.95rem;
}

details.rules {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  margin-bottom: 1rem;
}

details.rules summary {
  cursor: pointer;
  font-weight: 600;
  min-height: var(--touch);
  display: flex;
  align-items: center;
}

details.rules h3 {
  font-size: 1rem;
  margin-top: 0.75rem;
}

details.rules ul {
  margin: 0 0 0.5rem;
  padding-left: 1.25rem;
}

code.secret {
  display: inline-block;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  background: var(--surface-alt);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
  overflow-wrap: anywhere;
}

.banner {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--warning);
  color: #1d1b16;
  padding: 0.5rem 1rem;
  font-weight: 600;
}

.log {
  max-height: 10rem;
  overflow-y: auto;
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
  padding-left: 1.1rem;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
  button.card[aria-pressed="true"] {
    transform: none;
  }
}

/* The Card Club: ivory paper, forest felt and warm brass. */
.screen { max-width: 76rem; padding: 0 2.25rem 2.5rem; }
.club-header { display:flex; align-items:center; justify-content:space-between; min-height:88px; border-bottom:1px solid var(--line); margin-bottom:2rem; gap:1rem; }
.club-brand { display:flex; align-items:center; gap:1.25rem; color:var(--ink); text-decoration:none; font:bold 2.5rem Georgia,serif; letter-spacing:-3px; }
.club-brand span { border-left:1px solid var(--line); padding-left:1.25rem; font:600 .65rem system-ui,sans-serif; text-transform:uppercase; letter-spacing:2px; }
.club-private { display:flex; align-items:center; gap:.5rem; font-size:.75rem; color:var(--muted); }
.club-private::before { content:''; width:7px; height:7px; border-radius:50%; background:#49865c; }
h1 { font:normal 2.5rem/1.15 Georgia,serif; letter-spacing:-1px; margin-bottom:1.25rem; }
h2 { font-size:1.1rem; } h3 { font-size:1rem; }
.card-panel { padding:1.5rem; box-shadow:0 4px 16px #263b3104; }
button { transition:background .15s,transform .15s,box-shadow .15s; }
button:not([disabled]):hover { box-shadow:0 3px 9px #1f392414; background:#e1e7da; }
button.primary:not([disabled]):hover { background:#194a35; }
button.primary { box-shadow:0 3px 8px #225f4614; }
button[aria-pressed="true"]:not(.card) { background:var(--accent); color:#fff; border-color:var(--accent); }
input[type="text"],input[type="password"] { background:var(--surface); }
fieldset { border:1px solid var(--line); border-radius:var(--radius); padding:1rem; }
legend { padding:0 .4rem; font-weight:600; }
.eyebrow { font-size:.68rem; font-weight:700; letter-spacing:2px; text-transform:uppercase; }
.home-layout { display:grid; grid-template-columns:1fr 1fr; align-items:center; gap:5rem; padding:2rem 1rem 3.5rem; }
.home-copy h1 { font-size:clamp(3rem,5.5vw,4.5rem); line-height:1.05; letter-spacing:-2px; margin:1.1rem 0 1.5rem; }
.home-copy .lede { max-width:23rem; font-size:1.05rem; }
.home-create { margin:1rem 0 1.8rem; padding:.85rem 1.6rem; }
.home-create span { margin-left:.6rem; }
.home-join { border-top:1px solid var(--line); padding-top:1.4rem; max-width:25rem; }
.home-join h2 { font-size:1rem; }
.home-join label { font-size:.8rem; margin-top:.85rem; }
.join-row { display:flex; align-items:stretch; gap:.5rem; }
.join-row input { min-width:0; }
.home-art { position:relative; min-height:360px; background:radial-gradient(ellipse at 50% 30%,#2d6b50,#184632); border-radius:48%; border:12px solid #ece7dc; box-shadow:inset 0 0 0 1px #d9c29345,0 16px 35px #223b3110; }
.art-cards { display:flex; justify-content:center; position:absolute; inset:70px 0 auto; }
.art-cards .card { flex:none; width:110px; height:165px; border:0; padding:13px; box-shadow:0 15px 25px #0003; align-items:flex-start; justify-content:flex-start; }
.art-cards .card .rank { font:1.8rem Georgia,serif; }
.art-cards .card .suit { font-size:4.5rem; align-self:center; margin-top:.5rem; }
.art-cards .card:nth-child(1) { transform:translateX(18px) rotate(-18deg); }
.art-cards .card:nth-child(2) { transform:translateY(-16px) rotate(-4deg); }
.art-cards .card:nth-child(3) { transform:translateX(-18px) rotate(14deg); }
.art-caption { position:absolute; bottom:40px; left:0; right:0; text-align:center; text-transform:uppercase; letter-spacing:2px; font-size:.65rem; color:#e9dfc1; }
.club-footer { display:flex; justify-content:space-between; gap:1rem; border-top:1px solid var(--line); padding-top:1.2rem; font-size:.75rem; color:var(--muted); }
.status-line { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:.65rem; }
.status-line li { display:flex; flex-direction:column; gap:.25rem; padding:.65rem .85rem; color:var(--muted); font-size:.7rem; }
.status-line strong { font-size:.9rem; color:var(--ink); overflow-wrap:anywhere; }
.status-line li:nth-last-child(-n+2) { background:#e6ecdf; }
.game-layout { display:grid; grid-template-columns:minmax(0,1fr) 18rem; gap:1.5rem; align-items:start; margin-top:1.5rem; }
.game-table-column { min-width:0; }
.game-actions .card-panel { margin:0 0 1rem; }
.game-actions h2 { font:1.5rem Georgia,serif; margin-bottom:.85rem; }
.game-actions p { font-size:.9rem; }
.table { position:relative; min-height:380px; padding:16px 12px; grid-template-rows:auto minmax(140px,1fr) auto; grid-template-columns:minmax(90px,1fr) minmax(120px,2fr) minmax(90px,1fr); align-items:center; gap:12px; border:8px solid #e5dfd1; border-radius:100px; background:radial-gradient(ellipse at 50% 30%,#2b654c,#194b36); box-shadow:inset 0 0 0 1px #d6bd8150,0 8px 25px #223b3112; }
.table::before { content:'29'; position:absolute; pointer-events:none; left:50%; top:50%; transform:translate(-50%,-50%); color:#fff; opacity:.055; font:5rem Georgia,serif; }
.seat-box { z-index:1; color:#f4f1e3; border:0; background:transparent; padding:.35rem; font-size:.8rem; }
.seat-box.partner,.seat-box.you { justify-self:center; min-width:120px; }
.seat-name { max-width:160px; margin:0 auto; }
.seat-avatar { display:grid; place-items:center; width:34px; height:34px; margin:0 auto .35rem; border-radius:50%; border:1px solid #ffffff30; background:#ffffff16; font-size:.65rem; font-weight:700; }
.seat-box.turn { border:0; }
.seat-box.turn .seat-avatar { outline:2px solid #e8be75; outline-offset:3px; background:#ffffff25; }
.seat-box .flags { display:block; color:#cddacb; font-size:.65rem; }
.seat-box .turn-label { color:#f6d394; font-weight:700; }
.trick { position:relative; z-index:1; border:0; padding:0; min-height:110px; gap:8px; overflow:visible; }
.trick > span { display:flex; flex-direction:column; align-items:center; gap:5px; }
.trick .flags { color:#e2e8d6; font-size:.65rem; }
.trick > .flags { color:#dae4d2; font-size:.8rem; }
.card { width:64px; min-height:92px; padding:8px; border:1px solid #d4d4c7; background:#fffdf3; color:#263b31; align-items:flex-start; justify-content:space-between; box-shadow:0 3px 7px #17312412; flex-shrink:0; }
.card .rank { font:1.4rem Georgia,serif; }
.card .suit { font-size:2rem; align-self:center; }
.card.suit-H,.card.suit-D { color:#ab3839; }
.card.played { background:#fffdf3; box-shadow:0 6px 12px #0002; }
.hand-panel { padding:.5rem 0; }
.hand-panel h2 { font-size:.9rem; margin:.4rem 0 1rem; }
.hand { gap:6px; flex-wrap:wrap; padding-top:5px; }
button.card:not([disabled]):hover { background:#fffdf3; transform:translateY(-5px); box-shadow:0 6px 14px #17312420; }
button.card[aria-pressed="true"] { border:1px solid var(--accent); outline:2px solid var(--accent); outline-offset:2px; transform:translateY(-8px); background:#fffdf3; }
button.card[disabled] { opacity:.55; box-shadow:none; }
.reserved { border:2px dashed #b78a49; }
details.rules { padding:.6rem 1rem; margin-top:1.25rem; font-size:.9rem; }
details.rules summary { font-size:.8rem; color:var(--muted); }
.banner { background:#e8be75; color:#263b31; }
.seat-list { margin:1rem 0; }
.seat-list li { padding:1rem; }
.seat-list .is-you { background:#edf1e7; }
@media(min-width:1000px) { .status-line { grid-template-columns:repeat(8,minmax(0,1fr)); } }
@media(max-width:800px) {
  .screen { padding:0 1.25rem 2rem; }
  .club-header { min-height:76px; margin-bottom:1.5rem; }
  .home-layout { gap:2rem; padding:1.5rem 0 2.5rem; }
  .home-art { min-height:280px; border-width:8px; }
  .art-cards { top:55px; }
  .art-cards .card { width:82px; height:125px; }
  .art-cards .card .suit { font-size:3rem; }
  .art-caption { bottom:30px; font-size:.55rem; }
  .game-layout { grid-template-columns:1fr; gap:1rem; }
  .game-actions .card-panel { padding:1.25rem; }
}
@media(max-width:520px) {
  .screen { padding:0 .85rem 1.5rem; }
  .club-header { min-height:70px; margin-bottom:1.25rem; }
  .club-brand { gap:.75rem; font-size:2rem; }
  .club-brand span { padding-left:.75rem; font-size:.55rem; letter-spacing:1px; }
  .club-private { font-size:.65rem; }
  h1 { font-size:2rem; }
  .home-layout { grid-template-columns:1fr; gap:1.75rem; padding-top:.5rem; }
  .home-art { grid-row:1; min-height:205px; border-radius:24px; }
  .art-cards { top:35px; }
  .art-cards .card { width:76px; height:112px; padding:9px; }
  .art-cards .card .rank { font-size:1.3rem; }
  .art-cards .card .suit { font-size:2.8rem; }
  .art-caption { bottom:18px; }
  .home-copy h1 { font-size:3.25rem; }
  .home-copy .lede { font-size:1rem; }
  .home-join { max-width:none; }
  .club-footer { flex-direction:column; gap:.25rem; font-size:.65rem; }
  .status-line { gap:.4rem; }
  .status-line li { padding:.5rem; font-size:.6rem; }
  .status-line strong { font-size:.75rem; }
  .table { min-height:350px; border-width:5px; border-radius:58px; padding:12px 5px; gap:5px; grid-template-columns:minmax(58px,1fr) minmax(148px,2fr) minmax(58px,1fr); }
  .seat-box { padding:2px; font-size:.7rem; }
  .seat-box .flags { font-size:.6rem; }
  .seat-name { max-width:90px; }
  .trick { gap:5px; }
  .trick .card { width:44px; min-height:68px; min-width:0; padding:5px; }
  .trick .rank { font-size:1rem; }
  .trick .suit { font-size:1.4rem; }
  .hand { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; }
  .hand .card { width:100%; min-width:44px; min-height:80px; padding:7px; }
  .hand .rank { font-size:1.05rem; }
  .hand .suit { font-size:1.5rem; }
  .hand > li { min-height:73px; }
  .card-panel { padding:1.1rem; }
  .seat-list li { flex-wrap:wrap; }
}
@media(prefers-reduced-motion:reduce) {
  button.card:not([disabled]):hover,button.card[aria-pressed="true"] { transform:none; }
}
