:root {
  color-scheme: dark;
  --bg: #17151e;
  --panel: #272332;
  --gold: #d9b36b;
  --ink: #f5ecda;
  --muted: #b7acb8;
  --red: #a94755;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}
button,
.button {
  border: 1px solid #66546b;
  background: #312b3d;
  border-radius: 8px;
  padding: 10px 18px;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
}
button:hover,
.button:hover {
  border-color: var(--gold);
  background: #453849;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
button:disabled {
  opacity: 0.45;
  cursor: default;
}
.primary {
  background: var(--red);
  border-color: #cd7780;
}
.primary:hover {
  background: #be5665;
}
input,
select {
  background: #18151f;
  color: var(--ink);
  border: 1px solid #88768a;
  border-radius: 6px;
  padding: 12px;
  width: 100%;
}
label {
  display: block;
  margin: 12px 0 6px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(34px, 5vw, 64px);
  letter-spacing: 0.14em;
  font-weight: 600;
}
h2 {
  font-size: 24px;
}
h3 {
  font-size: 17px;
}
.topbar {
  padding: 20px 5%;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #3a3042;
}
.brand {
  color: var(--gold);
  font-size: 23px;
  text-decoration: none;
}
.brand span {
  font-size: 13px;
  color: var(--muted);
  margin-left: 12px;
}
nav {
  display: flex;
  gap: 8px;
}
nav button {
  font-size: 13px;
  padding: 8px 12px;
  background: transparent;
}
main {
  max-width: 1300px;
  margin: auto;
  padding: 32px;
}
.hero {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  min-height: 620px;
  background: var(--panel);
  border: 1px solid #49394c;
  border-radius: 16px;
  overflow: hidden;
}
.hero-art {
  min-height: 480px;
  background: url("/assets/opening.png") center/cover;
}
.hero-copy {
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.eyebrow {
  color: var(--gold);
  letter-spacing: 0.2em;
  font-size: 13px;
}
.muted,
.help {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.9;
}
.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 20px 0;
}
.actions button {
  flex-grow: 1;
}
.subtle {
  background: transparent;
  font-size: 13px;
}
.waiting {
  text-align: center;
  padding: 90px 20px;
}
.waiting-orbit {
  width: 72px;
  height: 72px;
  margin: 0 auto 28px;
  border: 1px solid #66516a;
  border-top: 2px solid var(--gold);
  border-radius: 50%;
  animation: spin 2s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 245px;
  gap: 22px;
}
.board {
  background: #233b34;
  border: 1px solid #61725c;
  border-radius: 14px;
  padding: 20px;
  box-shadow: inset 0 0 70px #111a1855;
}
.scorebar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.score {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.score strong {
  font-size: 24px;
  color: var(--gold);
}
.score small {
  color: var(--muted);
}
.round {
  text-align: center;
}
.turn-message {
  background: #152922;
  padding: 12px;
  border-radius: 7px;
  text-align: center;
  min-height: 48px;
  margin: 12px 0;
}
.cards {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  min-height: 100px;
}
.field {
  padding: 18px 0;
  border-top: 1px solid #597064;
  border-bottom: 1px solid #597064;
  min-height: 180px;
}
.card {
  padding: 0;
  border: 2px solid #fff0;
  border-radius: 5px;
  background: #fff8e7;
  width: 65px;
  height: 106px;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}
.card img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}
.card:disabled {
  opacity: 1;
  cursor: default;
}
.card.selectable {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold);
}
.card.selectable:hover {
  transform: translateY(-6px);
}
.card.back {
  background: repeating-linear-gradient(
    45deg,
    #332340,
    #332340 4px,
    #4c3656 4px,
    #4c3656 5px
  );
  border: 2px solid #c3a573;
  width: 30px;
  height: 48px;
}
.small-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 36px;
  margin: 8px 0;
}
.small-cards .card {
  width: 30px;
  height: 49px;
}
.capture-label {
  font-size: 12px;
  color: #d3d6c5;
  margin-top: 12px;
}
.captured-yaku {
  font-size: 12px;
  color: var(--gold);
}
.host-panel {
  background: var(--panel);
  border: 1px solid #594460;
  border-radius: 14px;
  overflow: hidden;
  align-self: start;
}
.portrait {
  width: 100%;
  aspect-ratio: 416/625;
  overflow: hidden;
  background: #302635;
}
.portrait svg {
  width: 100%;
  height: 100%;
  display: block;
}
.host-caption {
  padding: 18px;
}
.host-name {
  color: var(--gold);
  font-size: 15px;
  margin-bottom: 8px;
}
.host-line {
  line-height: 1.9;
  font-size: 14px;
  min-height: 90px;
}
.result {
  background: #302635;
  border: 1px solid #8b6c5b;
  padding: 24px;
  border-radius: 10px;
  margin: 15px 0;
}
.result h2 {
  color: var(--gold);
}
.greetings {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.greetings button {
  font-size: 12px;
  padding: 8px;
}
.paused {
  border: 1px solid #dda85f;
  padding: 14px;
  background: #3b3225;
  margin-bottom: 15px;
}
.pending {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 10px 0;
}
.tag {
  color: var(--gold);
  font-size: 12px;
}
footer {
  padding: 24px 5%;
  display: flex;
  gap: 24px;
  font-size: 12px;
  color: var(--muted);
  justify-content: center;
}
a {
  color: var(--gold);
}
dialog {
  width: min(720px, 94vw);
  max-height: 88vh;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid #8b6a6c;
  border-radius: 14px;
  padding: 32px;
}
dialog::backdrop {
  background: #08060dcc;
}
.close {
  position: absolute;
  right: 12px;
  top: 12px;
  padding: 4px 11px;
  font-size: 23px;
}
#dialog-content {
  padding-top: 10px;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 13px;
}
th,
td {
  padding: 10px 5px;
  text-align: left;
  border-bottom: 1px solid #554457;
}
th {
  color: var(--gold);
}
.table-wrap {
  overflow: auto;
}
.collection {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.collection-item {
  background: #1d1925;
  border: 1px solid #56455b;
  border-radius: 8px;
  padding: 14px;
  opacity: 0.5;
}
.collection-item.earned {
  opacity: 1;
  border-color: var(--gold);
}
.collection-item strong {
  display: block;
  font-size: 14px;
  margin-bottom: 7px;
}
#notice {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  background: #f4e8cd;
  color: #241c29;
  padding: 12px 22px;
  border-radius: 8px;
  max-width: 90vw;
  box-shadow: 0 5px 25px #0006;
  display: none;
}
.code {
  word-break: break-all;
  font-family: monospace;
  font-size: 14px;
  padding: 16px;
  background: #15111b;
  user-select: all;
}
.rules {
  max-width: 800px;
  margin: 40px auto;
  padding: 24px;
  line-height: 2;
}
.loading {
  text-align: center;
  padding: 90px;
}
.connection {
  color: var(--gold);
}
@media (max-width: 850px) {
  main {
    padding: 20px 12px;
  }
  .hero {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .hero-art {
    min-height: 260px;
    background-position: center 35%;
  }
  .hero-copy {
    padding: 30px 24px;
  }
  .board-layout {
    grid-template-columns: 1fr;
  }
  .host-panel {
    display: grid;
    grid-template-columns: 100px 1fr;
    grid-row: 1;
  }
  .portrait {
    height: 150px;
    width: 100px;
  }
  .host-caption {
    padding: 12px;
  }
  .host-line {
    min-height: 0;
    margin: 0;
  }
  .topbar {
    padding: 14px;
    flex-wrap: wrap;
  }
  nav {
    width: 100%;
    justify-content: space-between;
  }
  nav button {
    padding: 7px 10px;
  }
  .board {
    padding: 12px;
  }
  .cards {
    gap: 5px;
    min-height: 80px;
  }
  .card {
    width: calc((100vw - 86px) / 8);
    height: auto;
    aspect-ratio: 61/100;
    max-width: 65px;
  }
  .field {
    min-height: 140px;
  }
  .field .card {
    width: 52px;
  }
  .collection {
    grid-template-columns: repeat(2, 1fr);
  }
  .scorebar {
    gap: 8px;
  }
  .score strong {
    font-size: 20px;
  }
  .score span {
    font-size: 13px;
  }
  dialog {
    padding: 25px 18px;
  }
  footer {
    gap: 14px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

.waiting .actions { justify-content: center; flex-wrap: wrap; }
