:root {
  --ink: #17352e;
  --ink-dark: #0c2721;
  --cream: #f3eee2;
  --paper: #e8dfcd;
  --wood: #c99b61;
  --wood-light: #ddb77f;
  --red: #a94a39;
  --gold: #b9935a;
  --line: rgba(25, 58, 49, .19);
  --shadow: 0 26px 70px rgba(22, 39, 33, .13);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(rgba(247, 243, 234, .94), rgba(239, 232, 218, .94)),
    repeating-linear-gradient(0deg, transparent 0 4px, rgba(42, 65, 55, .035) 5px);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  overflow-x: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.ambient { position: fixed; border-radius: 50%; filter: blur(2px); pointer-events: none; z-index: -1; }
.ambient-one { width: 38vw; height: 38vw; right: -18vw; top: 10vh; background: radial-gradient(circle, rgba(169, 74, 57, .08), transparent 68%); }
.ambient-two { width: 34vw; height: 34vw; left: -16vw; bottom: -10vh; background: radial-gradient(circle, rgba(18, 71, 58, .1), transparent 68%); }
.app-shell { width: min(1440px, 100%); margin: 0 auto; padding: 0 42px 60px; }
.topbar { height: 96px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 13px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { width: 42px; height: 42px; position: relative; display: block; }
.brand-mark i { width: 28px; height: 28px; border-radius: 50%; position: absolute; box-shadow: inset -4px -5px 8px rgba(0,0,0,.28); }
.brand-mark i:first-child { background: var(--ink-dark); left: 0; top: 0; }
.brand-mark i:last-child { background: #e7ded0; border: 1px solid rgba(0,0,0,.1); right: 0; bottom: 0; box-shadow: inset -3px -4px 7px rgba(0,0,0,.09); }
.brand b { display: block; font-family: "STKaiti", "KaiTi", serif; font-size: 25px; letter-spacing: .2em; }
.brand small { display: block; font-size: 8px; letter-spacing: .18em; opacity: .58; margin-top: 2px; }
.top-actions { display: flex; align-items: center; gap: 18px; }
.connection { display: flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .12em; }
.connection i { width: 7px; height: 7px; background: #80a88b; border-radius: 50%; box-shadow: 0 0 0 4px rgba(128,168,139,.13); }
.connection i.offline { background: #a65c4f; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; background: transparent; color: var(--ink); display: grid; place-items: center; }
.icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; }
.hero { min-height: 365px; display: grid; grid-template-columns: 1fr 210px; align-items: center; padding: 38px 7vw 22px; }
.eyebrow, .section-heading span, .match-label span, .review-copy > span { font: 10px Georgia, serif; letter-spacing: .32em; color: var(--red); }
.hero h1 { margin: 12px 0 18px; font: 400 clamp(50px, 6vw, 82px)/1.1 "STKaiti", "KaiTi", serif; letter-spacing: .04em; }
.hero h1 em { color: var(--red); font-style: normal; }
.hero-copy { max-width: 510px; line-height: 1.9; letter-spacing: .08em; opacity: .68; font-size: 14px; }
.hero-card { width: 178px; height: 230px; padding: 22px; border: 1px solid rgba(169,74,57,.26); background: rgba(255,255,255,.2); display: flex; flex-direction: column; align-items: center; justify-content: center; position: relative; box-shadow: 14px 14px 0 rgba(23,53,46,.04); }
.hero-card::before, .hero-card::after { content: ""; position: absolute; width: 18px; height: 18px; border-color: var(--red); opacity: .5; }
.hero-card::before { left: 8px; top: 8px; border-left: 1px solid; border-top: 1px solid; }
.hero-card::after { right: 8px; bottom: 8px; border-right: 1px solid; border-bottom: 1px solid; }
.seal { width: 52px; height: 52px; display: grid; place-items: center; border: 2px solid var(--red); color: var(--red); font: 28px "STKaiti", serif; transform: rotate(-3deg); }
.hero-card p { margin: 20px 0 4px; font-size: 11px; letter-spacing: .35em; opacity: .5; }
.hero-card strong { font: 27px "STKaiti", serif; letter-spacing: .3em; margin-left: .3em; }
.hero-card span { margin-top: 15px; font-size: 9px; letter-spacing: .12em; opacity: .48; }
.panel { background: rgba(255,255,255,.25); border: 1px solid rgba(23,53,46,.12); box-shadow: var(--shadow); }
.lobby { max-width: 1080px; margin: 0 auto; padding: 38px 50px 48px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 23px; }
.section-heading h2 { margin: 7px 0 0; font: 31px "STKaiti", serif; letter-spacing: .12em; }
.section-heading p { margin: 0; font-size: 12px; opacity: .55; }
.lobby-grid { display: grid; grid-template-columns: 1fr 55px 1fr; gap: 20px; padding-top: 35px; }
.start-card { position: relative; padding: 32px 36px; background: var(--ink); color: var(--cream); min-height: 390px; }
.start-card.light-card { background: rgba(240,233,220,.68); color: var(--ink); border: 1px solid var(--line); }
.card-number { position: absolute; right: 26px; top: 24px; font: 45px "STKaiti", serif; opacity: .08; }
.card-icon { width: 50px; height: 50px; border-radius: 50%; margin-bottom: 22px; }
.black-stone { background: radial-gradient(circle at 34% 27%, #53635e, #17211f 48%, #050909 86%); box-shadow: 4px 7px 12px rgba(0,0,0,.28), inset -5px -7px 9px rgba(0,0,0,.35); }
.white-stone { background: radial-gradient(circle at 31% 24%, #fff, #eee8db 46%, #b7ad9e 94%); border: 1px solid rgba(0,0,0,.09); box-shadow: 4px 7px 12px rgba(0,0,0,.16), inset -4px -5px 8px rgba(0,0,0,.09); }
.start-card h3 { margin: 0; font: 27px "STKaiti", serif; letter-spacing: .15em; }
.start-card > p { opacity: .62; font-size: 12px; line-height: 1.7; margin: 9px 0 25px; }
.start-card label { display: block; font-size: 10px; letter-spacing: .16em; opacity: .86; margin-top: 14px; }
.start-card input { width: 100%; border: 0; border-bottom: 1px solid rgba(255,255,255,.25); color: inherit; background: transparent; padding: 10px 0 9px; outline: none; font-size: 14px; letter-spacing: .08em; border-radius: 0; }
.light-card input { border-bottom-color: var(--line); }
.start-card input:focus { border-bottom-color: var(--gold); }
.primary-button, .secondary-button { width: 100%; border: 0; margin-top: 27px; padding: 14px 18px; display: flex; justify-content: space-between; background: var(--cream); color: var(--ink); letter-spacing: .14em; font-size: 12px; }
.secondary-button { background: var(--red); color: white; }
.divider-mark { display: grid; place-items: center; position: relative; }
.divider-mark::before { content: ""; width: 1px; height: 100%; background: var(--line); position: absolute; }
.divider-mark span { z-index: 1; background: #ede6d9; border: 1px solid var(--line); width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font: 14px "STKaiti", serif; }
.game-layout { display: grid; grid-template-columns: 235px minmax(480px, 720px) 250px; gap: 28px; align-items: start; justify-content: center; padding-top: 36px; }
.side-panel { padding: 25px 22px; background: rgba(255,255,255,.28); border: 1px solid var(--line); min-height: 580px; }
.match-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 35px; }
.match-label i { width: 7px; height: 7px; border-radius: 50%; background: #77a286; box-shadow: 0 0 0 5px rgba(119,162,134,.12); }
.player-card { display: grid; grid-template-columns: 43px 1fr; align-items: center; gap: 13px; padding: 14px 0; position: relative; opacity: .58; transition: .25s; }
.player-card.active { opacity: 1; transform: translateX(4px); }
.player-stone { width: 42px; height: 42px; border-radius: 50%; }
.player-card small { display: block; font: 8px Georgia, serif; letter-spacing: .12em; opacity: .55; }
.player-card strong { display: block; font: 16px "STKaiti", serif; margin-top: 5px; letter-spacing: .08em; }
.turn-badge { display: none; position: absolute; right: 0; top: 8px; font-size: 8px; color: var(--red); }
.player-card.active .turn-badge { display: block; }
.versus { display: flex; align-items: center; gap: 10px; margin: 8px 0; opacity: .35; }
.versus i { height: 1px; background: var(--ink); flex: 1; }
.versus span { font: 15px "STKaiti", serif; }
.invite-box { margin-top: 40px; border-top: 1px solid var(--line); padding-top: 25px; }
.invite-box small { font-size: 10px; letter-spacing: .15em; opacity: .5; }
.invite-box div { display: flex; align-items: center; justify-content: space-between; margin: 10px 0; }
.invite-box b { font: 22px Georgia, serif; letter-spacing: .18em; }
.invite-box button, .mini-button { border: 1px solid var(--line); background: transparent; color: var(--ink); padding: 7px 9px; font-size: 9px; letter-spacing: .1em; }
.invite-box p { font-size: 10px; opacity: .5; line-height: 1.7; }
.text-button { border: 0; background: transparent; color: var(--ink); opacity: .48; font-size: 10px; padding: 0; margin-top: 30px; border-bottom: 1px solid; }
.board-stage { min-width: 0; }
.status-line { display: flex; justify-content: space-between; align-items: center; margin: 0 3px 13px; font-size: 10px; letter-spacing: .12em; }
.status-line strong { font: 18px "STKaiti", serif; letter-spacing: .12em; }
.board-frame { position: relative; padding: 28px; background: #9e7045; box-shadow: 0 24px 50px rgba(27,35,30,.22), inset 0 0 0 8px rgba(91,54,29,.2), inset 0 0 0 9px rgba(255,255,255,.12); }
.board { aspect-ratio: 1; position: relative; background-color: var(--wood-light); background-image: linear-gradient(rgba(70,45,25,.65) 1px, transparent 1px), linear-gradient(90deg, rgba(70,45,25,.65) 1px, transparent 1px), repeating-linear-gradient(6deg, transparent 0 8px, rgba(113,70,37,.04) 9px 10px); background-size: calc(100% / 14) calc(100% / 14), calc(100% / 14) calc(100% / 14), auto; background-position: 0 0; box-shadow: inset 0 0 22px rgba(100,58,26,.22); }
.point { position: absolute; width: calc(100% / 14); height: calc(100% / 14); transform: translate(-50%, -50%); border: 0; background: transparent; padding: 7px; display: grid; place-items: center; z-index: 2; }
.point:hover::before { content: ""; width: 32%; height: 32%; border-radius: 50%; background: rgba(169,74,57,.28); }
.board.locked .point:hover::before { display: none; }
.stone { width: 86%; height: 86%; border-radius: 50%; display: grid; place-items: center; font: 9px Georgia, serif; animation: place .18s ease-out; box-shadow: 2px 4px 6px rgba(30,24,17,.28); }
.stone.black { color: rgba(255,255,255,.6); background: radial-gradient(circle at 34% 28%, #58635f, #18211f 45%, #050807 87%); }
.stone.white { color: rgba(29,52,45,.62); background: radial-gradient(circle at 32% 27%, #fff, #eee9df 48%, #afa698 95%); border: 1px solid rgba(0,0,0,.12); }
.stone.latest { outline: 2px solid var(--red); outline-offset: -3px; }
.star { position: absolute; width: 7px; height: 7px; border-radius: 50%; background: rgba(64,41,22,.8); transform: translate(-50%,-50%); z-index: 1; }
@keyframes place { from { transform: scale(1.25); opacity: .45; } to { transform: scale(1); opacity: 1; } }
.board-coordinates { position: absolute; color: rgba(255,255,255,.65); font: 8px Georgia, serif; }
.board-coordinates.cols { left: 28px; right: 28px; top: 10px; display: flex; justify-content: space-between; }
.board-coordinates.rows { left: 10px; top: 28px; bottom: 28px; display: flex; flex-direction: column; justify-content: space-between; }
.board-hint { text-align: center; font-size: 9px; opacity: .45; letter-spacing: .15em; margin-top: 14px; }
.history-panel { display: flex; flex-direction: column; }
.history-head { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 17px; }
.history-head span { display: block; color: var(--red); font-size: 8px; letter-spacing: .25em; }
.history-head strong { display: block; font: 18px "STKaiti", serif; letter-spacing: .12em; margin-top: 5px; }
.mini-button:disabled { opacity: .28; cursor: default; }
.history-list { flex: 1; max-height: 465px; overflow-y: auto; padding: 13px 0; scrollbar-width: thin; }
.empty-history { height: 300px; display: grid; place-content: center; text-align: center; opacity: .3; }
.empty-history span { font: 30px serif; }
.empty-history p { font-size: 10px; line-height: 1.8; }
.history-row { display: grid; grid-template-columns: 30px 24px 1fr auto; gap: 7px; align-items: center; padding: 8px 4px; border-bottom: 1px solid rgba(23,53,46,.07); font-size: 10px; }
.history-row b { font: 10px Georgia, serif; opacity: .45; }
.history-dot { width: 15px; height: 15px; border-radius: 50%; }
.history-row span:last-child { opacity: .4; font-size: 8px; }
.history-footer { display: flex; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 16px; font-size: 9px; letter-spacing: .1em; }
.modal-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(8,25,21,.75); backdrop-filter: blur(8px); display: grid; place-items: center; padding: 20px; }
.review-modal { width: min(720px, 100%); max-height: 94vh; overflow: auto; background: var(--cream); padding: 30px 42px 35px; position: relative; box-shadow: 0 30px 90px rgba(0,0,0,.35); }
.close-button { position: absolute; top: 18px; right: 20px; border: 0; background: transparent; color: var(--ink); font-size: 26px; font-weight: 200; }
.review-copy { text-align: center; }
.review-copy h2 { margin: 6px 0; font: 26px "STKaiti", serif; }
.review-copy p { font-size: 10px; opacity: .5; }
.review-board-wrap { max-width: 470px; margin: 24px auto; padding: 22px; background: #9e7045; }
.review-board .point { cursor: default; }
.review-controls { display: grid; grid-template-columns: 38px 1fr 38px 70px; gap: 12px; align-items: center; }
.review-controls button { border: 1px solid var(--line); background: transparent; color: var(--ink); height: 34px; }
.review-controls input { accent-color: var(--red); }
.review-controls b { text-align: right; font: 12px "STKaiti", serif; }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 20px); background: var(--ink-dark); color: white; padding: 11px 20px; font-size: 11px; letter-spacing: .08em; opacity: 0; pointer-events: none; transition: .25s; z-index: 30; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1120px) {
  .game-layout { grid-template-columns: 200px minmax(460px, 650px); }
  .history-panel { grid-column: 1 / -1; min-height: auto; }
  .history-list { max-height: 210px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 20px; }
  .history-footer { grid-column: 1 / -1; }
}
@media (max-width: 760px) {
  .app-shell { padding: 0 15px 35px; }
  .topbar { height: 75px; }
  .connection span { display: none; }
  .hero { min-height: 330px; display: block; padding: 56px 10px 35px; }
  .hero h1 { font-size: 52px; }
  .hero-card { display: none; }
  .lobby { padding: 27px 18px; }
  .section-heading p { display: none; }
  .lobby-grid { grid-template-columns: 1fr; }
  .divider-mark { height: 34px; }
  .divider-mark::before { width: 100%; height: 1px; }
  .start-card { padding: 28px; }
  .game-layout { display: flex; flex-direction: column; padding-top: 20px; gap: 15px; }
  .board-stage { order: 1; width: 100%; }
  .left-panel { order: 2; width: 100%; min-height: auto; display: grid; grid-template-columns: 1fr 1fr; column-gap: 22px; }
  .left-panel .match-label, .left-panel .invite-box, .left-panel .text-button { grid-column: 1 / -1; }
  .left-panel .versus { display: none; }
  .history-panel { order: 3; width: 100%; min-height: 360px; }
  .board-frame { padding: 20px; }
  .board-coordinates.cols { left: 20px; right: 20px; top: 6px; }
  .board-coordinates.rows { top: 20px; bottom: 20px; left: 6px; }
  .stone { font-size: 7px; width: 90%; height: 90%; }
  .review-modal { padding: 28px 18px; }
  .review-board-wrap { padding: 16px; }
  .history-list { display: block; max-height: 260px; }
}
