:root {
  color-scheme: light;
  font-family: Inter, "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  color: #252521;
  background: #f5efe5;
  font-synthesis: none;
  --paper: #fffdf8;
  --ink: #252521;
  --muted: #6c675e;
  --line: #ded6c8;
  --orange: #a83d25;
  --green: #1c493f;
  --radius: 22px;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
h1, h2, p { margin: 0; }
h1, h2 { letter-spacing: -.055em; }
button, input { font: inherit; }
button:not(:disabled) { cursor: pointer; }
:focus-visible { outline: 3px solid #bd632b; outline-offset: 4px; }
button:disabled { opacity: .5; }
ul { list-style: none; margin: 0; padding: 0; }

.shell {
  width: min(1100px, calc(100% - 48px));
  margin: 0 auto;
  padding-bottom: 48px;
}

.header, .header-nav, .logo, .panel-header, .actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.header {
  min-height: 76px;
  justify-content: space-between;
}

.header-nav, .actions, .panel-header { flex-wrap: wrap; }
.header-nav { justify-content: flex-end; }
.logo { font-weight: 850; letter-spacing: -.04em; font-size: 21px; }

.logo-mark { width: 36px; height: 36px; flex-shrink: 0; }

.text-button {
  border: 0;
  background: transparent;
  padding: 8px 10px;
  color: inherit;
  font-size: .89rem;
  font-weight: 720;
  white-space: nowrap;
}

.text-button:hover:not(:disabled) { text-decoration: underline; }

.hero {
  isolation: isolate;
  overflow: hidden;
  position: relative;
  min-height: 360px;
  display: flex;
  align-items: center;
  background: radial-gradient(ellipse at 78% 20%, #d87343, #a83d25 60%, #93331e 100%);
  color: #fff6e3;
  border-radius: calc(var(--radius) + 4px);
}

.hero::before {
  position: absolute;
  inset: 13px;
  content: "";
  border: 1px solid #fff3d74a;
  border-radius: 16px;
  pointer-events: none;
}

.hero-content { z-index: 1; padding: 42px clamp(30px, 6vw, 75px); }
.hero-suits { letter-spacing: .35em; color: #ffdab6; font-size: .84rem; }
.hero h1 { font-size: clamp(72px, 10vw, 120px); font-weight: 900; line-height: .99; margin: 10px 0 18px; }
.hero p { color: #fff0de; font-size: clamp(16px, 2vw, 20px); line-height: 1.55; white-space: pre-line; }
.hero button { margin-top: 22px; }
html[lang="en"] .hero-content { max-width: 60%; }
html[lang="en"] .hero h1 { font-size: clamp(52px, 9vw, 112px); }

.hero-deck {
  position: absolute;
  z-index: 0;
  width: 49%;
  height: 100%;
  right: 0;
  top: 0;
  pointer-events: none;
}

.hero-deck::before {
  content: "";
  position: absolute;
  width: min(410px, 100%);
  aspect-ratio: 1;
  left: 13%;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid #f8ddab55;
  border-radius: 50%;
  box-shadow: 0 0 0 28px #f8ddab19, 0 0 0 56px #f8ddab0e;
}

.card {
  --card-width: 66px;
  appearance: none;
  width: var(--card-width);
  flex: 0 0 var(--card-width);
  height: calc(var(--card-width) * 1.42);
  display: block;
  position: relative;
  border: 1px solid #ded8cc;
  border-radius: 8px;
  background: #fffdf5;
  color: #202a25;
  box-shadow: 0 3px 5px #241b1230;
  font-weight: 850;
  padding: 0;
}

.card.red { color: #b93831; }
.card-index {
  position: absolute;
  top: .38em;
  left: .46em;
  font-size: clamp(12px, calc(var(--card-width) * .25), 24px);
  display: block;
  white-space: pre;
  text-align: center;
  line-height: .94;
}
.card-mark {
  display: grid;
  height: 100%;
  place-items: center;
  font-size: calc(var(--card-width) * .57);
  line-height: 1;
}

.hero-deck .card {
  --card-width: clamp(104px, 16vw, 179px);
  position: absolute;
  top: 50%;
  left: 46%;
  box-shadow: 0 15px 28px #5b1d1470;
  border-radius: 16px;
}

.hero-deck .card::before {
  content: "";
  position: absolute;
  inset: 34px 12px;
  border: 1px solid currentColor;
  opacity: .17;
  border-radius: 50%;
}

.hero-deck .card:nth-child(1) { transform: translate(-96%, -47%) rotate(-25deg); background: #f2dcb9; }
.hero-deck .card:nth-child(2) { transform: translate(-53%, -54%) rotate(-8deg); background: #fff0d3; }
.hero-deck .card:nth-child(3) {
  transform: translate(-4%, -49%) rotate(17deg);
  color: #fff3d2;
  background: #153e35;
  border-color: #416a59;
}

.lobby-panels {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 18px;
  margin-top: 18px;
  align-items: stretch;
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  padding: 23px;
}

.panel-header { justify-content: space-between; }
.panel h2 { font-size: 1.35rem; font-weight: 830; }

.button {
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--green);
  color: #fffaf0;
  font-weight: 760;
  padding: 10px 17px;
  min-height: 44px;
}

.button:not(:disabled):hover { filter: brightness(1.14); }
.button.light { background: #fff2d9; color: #622d20; }
.button.outline { background: transparent; color: var(--green); border-color: #b7c2b7; }
.button.compact { padding-inline: 13px; font-size: .9rem; }
.muted { color: var(--muted); }

.empty {
  padding: 30px 4px 20px;
  display: grid;
  gap: 8px;
  justify-items: center;
  text-align: center;
}

.empty-symbol {
  display: grid;
  width: 48px;
  aspect-ratio: 1;
  place-items: center;
  border: 1px solid #d5ded3;
  background: #e8efe5;
  color: var(--green);
  border-radius: 50%;
  font-size: 1.65rem;
  margin-bottom: 3px;
}

.empty p { font-weight: 730; }
.empty .muted { font-size: .92rem; }
.room-items { margin-top: 14px; }
.room-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.room-item div, .seat div { min-width: 0; overflow-wrap: anywhere; }
.room-item span, .seat div span { display: block; margin-top: 3px; font-size: .86rem; }
.room-item span { color: var(--muted); }

.create { display: grid; gap: 13px; }
.field {
  display: grid;
  font-size: .88rem;
  font-weight: 710;
  gap: 5px;
}
.field input {
  min-width: 0;
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #f9f6ef;
  color: var(--ink);
  border-radius: 9px;
  padding: 8px 10px;
}

.waiting { max-width: 690px; margin: 22px auto 0; }
.waiting h1 { overflow-wrap: anywhere; }
.waiting p { margin-top: 5px; }
.seats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 24px 0; }
.seat { display: flex; align-items: center; gap: 10px; min-width: 0; }
.seat { background: #f7f1e6; border-radius: 13px; padding: 10px; }
.seat-mark {
  display: grid;
  flex: 0 0 37px;
  height: 37px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: #2d5248;
  font-size: 1.3rem;
}
.seat-1 { background: #a83d25; }
.seat-2 { background: #425177; }
.seat-3 { background: #795923; }

.table {
  min-height: 365px;
  display: grid;
  grid-template-rows: auto 1fr;
  background: radial-gradient(ellipse at 52% 68%, #2c6251, #183f37 77%);
  color: #fff8e8;
  border: 1px solid #15352e;
  border-radius: 24px;
  padding: 22px;
}
.opponents { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

.table-center { display: grid; align-content: center; justify-items: center; gap: 18px; padding: 16px 0 24px; }
.turn { font-weight: 850; font-size: 1.4rem; text-align: center; overflow-wrap: anywhere; }
.trick { display: flex; align-items: center; justify-content: center; gap: 5px; min-height: 100px; }
.trick > span:not(.card) { color: #d5e3d6; }
.bot-action { color: #d5e3d6; min-height: 1.4em; font-size: .9rem; text-align: center; }
.hand-panel { margin-top: 12px; }
.play-hint { color: var(--muted); font-size: .9rem; min-height: 1.4em; margin-top: 8px; }
.hand { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 18px; padding-bottom: 3px; }
.hand .card { --card-width: clamp(42px, 6vw, 65px); transition: transform 120ms; }
.hand .card[aria-pressed="true"] {
  border: 2px solid #b9502f;
  background: #fff4d9;
  transform: translateY(-6px);
  box-shadow: 0 4px 0 #b9502f;
}
.hand button.card:hover { transform: translateY(-3px); }
.hand button.card[aria-pressed="true"]:hover { transform: translateY(-6px); }

.notice {
  margin-bottom: 14px;
  padding: 11px 14px;
  border-radius: 10px;
  background: #e3ede2;
  color: #1b4838;
}
.notice.error { color: #7d251c; background: #f6dfd7; }
.rules {
  width: min(670px, calc(100% - 24px));
  max-height: 88dvh;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0;
  color: var(--ink);
  background: var(--paper);
}
.rules::backdrop { background: #101e1b9c; }

@media (max-width: 700px) {
  .shell { width: calc(100% - 30px); }
  .lobby-panels { grid-template-columns: 1fr; }
  .create { grid-row: 1; }
  .hero { min-height: 300px; }
  .hero-content { padding-left: 25px; }
  .hero-deck { right: -1%; width: 49%; }
  .panel { padding: 17px; }
  .table { padding: 12px 8px; min-height: 280px; }
  .hand .card { --card-width: clamp(42px, 9vw, 60px); }
}

@media (max-width: 450px) {
  .hero-deck { opacity: .84; width: 43%; right: -4%; }
  .hero-deck .card { --card-width: 88px; }
  .hero-deck .card:nth-child(1) { transform: translate(-89%, -30%) rotate(-25deg); }
  .hero-deck .card:nth-child(2) { transform: translate(-63%, -38%) rotate(-8deg); }
  .hero-deck .card:nth-child(3) { transform: translate(-17%, -41%) rotate(17deg); }
  .hero h1 { font-size: 68px; }
  .hero p { font-size: 15px; }
  .table-center .card { --card-width: 46px; }
  .actions { gap: 6px; }
  .actions .button { padding-inline: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  .hand .card { transition: none; }
}

.rules-link { text-decoration: none; }
.settings-button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--green);
  font-size: 1.25rem;
}
.settings-button:hover { background: #efe9db; }
.settings {
  width: min(380px, calc(100% - 24px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--ink);
  background: var(--paper);
}
.settings::backdrop { background: #101e1b9c; }
.settings h3 { margin: 18px 0 8px; font-size: .95rem; }
.language-options { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; }
.language-option {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
}
.language-option:hover { background: #efece4; }
.language-option[aria-current="true"] {
  border-color: var(--green);
  background: #e4eee4;
  color: var(--green);
  font-weight: 800;
}
.opponent {
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-self: stretch;
  gap: 6px;
  padding: 10px 12px;
  background: #142d2766;
  border: 1px solid #ffffff24;
  border-radius: 12px;
  min-width: 0;
}
.opponent.active { border-color: #ffc985; background: #142d279e; }
.opponent-identity { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.opponent .seat-mark { flex: 0 0 24px; height: 24px; border-radius: 7px; font-size: .9rem; }
.opponent-identity strong { min-width: 0; overflow-wrap: anywhere; }
.opponent .opponent-turn { color: #253627; background: #ffd59f; border-radius: 4px; padding: 1px 4px; margin: 0; font-size: .72rem; font-weight: 800; }
.opponent-count { display: flex; align-items: baseline; gap: 4px; white-space: nowrap; }
.count-value { font-size: clamp(1.35rem, 4vw, 1.85rem); line-height: 1; font-variant-numeric: tabular-nums; }
.opponent-count .count-unit { font-size: .75rem; color: #d5e3d6; }
.opponent.last-card .opponent-count { color: #ffd59f; }
.opponent.last-card .count-unit { color: inherit; }
.opponent-count .card-stack {
  align-self: center;
  flex: 0 0 12px;
  height: 15px;
  margin: 0 4px 0 0;
  border: 1px solid #f1ddbc;
  border-radius: 2px;
  box-shadow: 2px -2px 0 -1px #142d27, 3px -3px 0 -1px #f1ddbc;
}
.hand-track { height: 4px; border-radius: 3px; background: #ffffff2c; overflow: hidden; }
.hand-track::before { content: ""; display: block; height: 100%; width: var(--remaining); background: #ffd59f; }
.trick-label { color: #d5e3d6; font-size: .9rem; }

.rules-toolbar {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 18px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  font-weight: 800;
}
.rules-content, .rules-page { padding: clamp(16px, 4vw, 28px); }
.rules-page { width: min(760px, 100%); margin: 0 auto; }
.rules-page > a { display: inline-block; margin-bottom: 16px; }
.rules-guide { line-height: 1.6; }
.rules-guide h1 { font-size: clamp(1.65rem, 5vw, 2.2rem); }
.rules-guide section { margin-top: 26px; }
.rules-guide h2 { font-size: 1.25rem; margin-bottom: 6px; }
.rules-guide h3 { margin: 0; font-size: 1rem; }
.rules-steps, ol.example-list { padding-left: 24px; }
.rules-steps li + li, .example-list li + li { margin-top: 12px; }
.example-list li { padding: 10px; background: #f4eee2; border-radius: 9px; }
.example-list { margin: 12px 0; }
.example-hand { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0; }
.example-card {
  display: grid;
  place-items: center;
  width: 40px;
  min-height: 47px;
  border: 1px solid #ded8cc;
  border-radius: 6px;
  background: #fffdf5;
  color: #202a25;
  font-weight: 800;
}
.example-card.red { color: #a82e27; }
.rank-order { font-weight: 800; color: var(--green); margin-bottom: 6px; }

@media (max-width: 450px) {
  .header { flex-wrap: wrap; gap: 4px; padding-block: 12px; }
  .header-nav { margin-left: auto; gap: 3px; }
  .header-nav .text-button { padding-inline: 7px; }
  html[lang="en"] .hero-content { max-width: 68%; padding-right: 6px; }
  html[lang="en"] .hero h1 { font-size: clamp(41px, 12vw, 52px); }
  html[lang="en"] .hero-deck { width: 36%; overflow: hidden; opacity: .65; }
  .opponent { padding: 7px 6px; text-align: left; }
  .opponent-identity { gap: 4px; font-size: .83rem; }
  .opponent .seat-mark { flex-basis: 19px; height: 19px; font-size: .75rem; }
  .opponent-count .card-stack { display: none; }
}
