:root {
  --ink: #111411;
  --muted: #5f675f;
  --paper: #f7f2e7;
  --surface: #fffaf0;
  --line: #d8cdb8;
  --wood: #c69358;
  --red: #b73535;
  --green: #1d6c57;
  --blue: #255f8e;
  --shadow: 0 24px 70px rgba(47, 36, 20, 0.16);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 72px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid rgba(17, 20, 17, 0.1);
  background: rgba(247, 242, 231, 0.92);
  backdrop-filter: blur(18px);
}

.brand,
.nav-links,
.hero-actions,
.preview-toolbar,
.preview-status,
.waitlist-section,
.signup-form div {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  width: 28px;
  height: 28px;
  border: 2px solid var(--ink);
  background:
    linear-gradient(90deg, transparent 47%, var(--ink) 48%, var(--ink) 52%, transparent 53%),
    linear-gradient(0deg, transparent 47%, var(--ink) 48%, var(--ink) 52%, transparent 53%),
    var(--wood);
  transform: rotate(45deg);
}

.nav-links {
  gap: 26px;
  color: var(--muted);
  font-size: 0.95rem;
}

.nav-cta,
.primary-action,
.secondary-action,
.signup-form button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--ink);
  padding: 0 18px;
  font-weight: 750;
}

.nav-cta,
.primary-action,
.signup-form button {
  background: var(--ink);
  color: var(--surface);
}

.secondary-action {
  background: transparent;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(360px, 1.08fr);
  gap: clamp(28px, 5vw, 72px);
  min-height: calc(100vh - 72px);
  padding: clamp(48px, 7vw, 96px) clamp(20px, 4vw, 64px) 52px;
  align-items: center;
}

.hero-copy {
  max-width: 760px;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 840px;
  margin-bottom: 20px;
  font-size: clamp(3.25rem, 8vw, 7.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.4rem;
}

.lead {
  max-width: 700px;
  color: #373d36;
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  line-height: 1.75;
}

.hero-actions {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.arena-preview {
  width: min(100%, 680px);
  justify-self: end;
  padding: clamp(14px, 2vw, 22px);
  border: 1px solid rgba(17, 20, 17, 0.16);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.preview-toolbar {
  gap: 8px;
  margin-bottom: 16px;
}

.game-tab {
  min-height: 38px;
  border: 1px solid rgba(17, 20, 17, 0.16);
  background: transparent;
  color: var(--muted);
  padding: 0 14px;
  cursor: pointer;
}

.game-tab.active {
  background: var(--ink);
  color: var(--surface);
}

.board-shell {
  position: relative;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border: 2px solid var(--ink);
  background: #e2b66f;
}

.board {
  position: absolute;
  inset: 0;
  display: none;
  gap: 0;
}

.board.active {
  display: grid;
}

.board span {
  display: grid;
  place-items: center;
  min-width: 0;
  min-height: 0;
  border: 1px solid rgba(17, 20, 17, 0.62);
  font-weight: 850;
  line-height: 1;
}

.shogi-board {
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
}

.shogi-board span {
  font-size: clamp(1.1rem, 4vw, 2.15rem);
}

.chess-board {
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
}

.chess-board span {
  border-color: rgba(17, 20, 17, 0.2);
  font-size: clamp(1.8rem, 5vw, 3.3rem);
}

.chess-board span:nth-child(16n + 1),
.chess-board span:nth-child(16n + 3),
.chess-board span:nth-child(16n + 5),
.chess-board span:nth-child(16n + 7),
.chess-board span:nth-child(16n + 10),
.chess-board span:nth-child(16n + 12),
.chess-board span:nth-child(16n + 14),
.chess-board span:nth-child(16n + 16) {
  background: #2d5749;
  color: #fff7df;
}

.chess-board span:nth-child(16n + 2),
.chess-board span:nth-child(16n + 4),
.chess-board span:nth-child(16n + 6),
.chess-board span:nth-child(16n + 8),
.chess-board span:nth-child(16n + 9),
.chess-board span:nth-child(16n + 11),
.chess-board span:nth-child(16n + 13),
.chess-board span:nth-child(16n + 15) {
  background: #f3d9a5;
}

.xiangqi-board {
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(10, 1fr);
}

.xiangqi-board span {
  color: var(--red);
  font-size: clamp(1.05rem, 3.7vw, 2rem);
}

.xiangqi-board span:nth-child(-n + 36) {
  color: var(--ink);
}

.river {
  color: var(--blue) !important;
  font-size: clamp(0.78rem, 2.3vw, 1.25rem) !important;
}

.focus {
  background: var(--ink) !important;
  color: var(--surface) !important;
}

.preview-status {
  gap: 9px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.92rem;
}

.live-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 6px rgba(29, 108, 87, 0.12);
}

.lineage-section,
.section-band,
.arena-section,
.vision-section,
.waitlist-section {
  padding: clamp(64px, 8vw, 118px) clamp(20px, 4vw, 64px);
}

.section-heading {
  max-width: 920px;
}

.section-note {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.7;
}

.lineage-section {
  border-top: 1px solid var(--line);
  background: #fbf7ee;
}

.lineage-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 30px;
}

.lineage-grid article {
  min-height: 112px;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.lineage-grid strong,
.lineage-grid span {
  display: block;
}

.lineage-grid strong {
  margin-bottom: 12px;
  font-size: 1.18rem;
}

.lineage-grid span {
  color: var(--muted);
  line-height: 1.5;
}

.principle-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.principle-card {
  min-height: 260px;
  padding: 28px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.principle-card p,
.vision-section p,
.metric-list span {
  color: var(--muted);
  line-height: 1.7;
}

.principle-card.featured {
  background: #20342d;
  color: var(--surface);
}

.principle-card.featured p {
  color: #c9ddd4;
}

.principle-card.featured .card-symbol {
  border-color: var(--surface);
  background: var(--surface);
  color: var(--ink);
}

.card-symbol {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  margin-bottom: 26px;
  border: 2px solid var(--ink);
  background: #e8c073;
  font-size: 1.65rem;
  font-weight: 850;
}

.arena-section {
  display: grid;
  grid-template-columns: minmax(0, 0.98fr) minmax(320px, 0.82fr);
  gap: clamp(28px, 6vw, 80px);
  background: #1f2f2a;
  color: var(--surface);
}

.arena-section .eyebrow,
.arena-section .metric-list span {
  color: #b7d7c8;
}

.metric-list {
  display: grid;
  gap: 14px;
  align-content: start;
}

.metric-list div {
  padding: 22px 0;
  border-bottom: 1px solid rgba(255, 250, 240, 0.22);
}

.metric-list strong,
.metric-list span {
  display: block;
}

.metric-list strong {
  margin-bottom: 8px;
  font-size: 1.18rem;
}

.vision-section {
  max-width: 1120px;
}

.vision-section p {
  max-width: 820px;
  font-size: 1.15rem;
}

.structure-map {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  max-width: 900px;
  margin-top: 34px;
}

.structure-map span {
  display: grid;
  min-height: 58px;
  place-items: center;
  border: 1px solid var(--ink);
  background: var(--surface);
  font-weight: 850;
}

.waitlist-section {
  justify-content: space-between;
  gap: 28px;
  border-top: 1px solid var(--line);
}

.waitlist-section h2 {
  max-width: 680px;
}

.signup-form {
  min-width: min(100%, 460px);
}

.signup-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.signup-form input {
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--ink);
  background: var(--surface);
  padding: 0 14px;
}

.signup-form button {
  min-height: 50px;
  cursor: pointer;
}

.form-status {
  min-height: 22px;
  margin: 10px 0 0;
  color: var(--green);
  font-size: 0.92rem;
  font-weight: 750;
}

.compare-hero,
.compare-controls,
.comparison-section,
.game-matrix-section,
.piece-atlas-section {
  padding: clamp(56px, 7vw, 96px) clamp(20px, 4vw, 64px);
}

.compare-hero {
  border-bottom: 1px solid var(--line);
}

.compare-hero h1 {
  max-width: 980px;
}

.compare-controls {
  display: grid;
  grid-template-columns: minmax(260px, 0.62fr) minmax(0, 1fr);
  gap: 28px;
  align-items: end;
  padding-bottom: 32px;
}

.compare-controls h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 3.5vw, 3.4rem);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.filter-button {
  min-height: 38px;
  border: 1px solid rgba(17, 20, 17, 0.18);
  background: var(--surface);
  color: var(--muted);
  padding: 0 13px;
  cursor: pointer;
  font-weight: 750;
}

.filter-button.active {
  background: var(--ink);
  color: var(--surface);
}

.comparison-section {
  padding-top: 0;
}

.comparison-table {
  border: 1px solid var(--ink);
  background: var(--surface);
}

.comparison-row {
  display: grid;
  grid-template-columns: minmax(130px, 0.38fr) minmax(170px, 0.5fr) minmax(0, 1.45fr);
}

.comparison-row[hidden] {
  display: none;
}

.comparison-row > div {
  min-width: 0;
  padding: 18px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  line-height: 1.7;
}

.comparison-row > div:last-child {
  border-right: 0;
}

.comparison-row:last-child > div {
  border-bottom: 0;
}

.comparison-head {
  background: var(--ink);
  color: var(--surface);
  font-weight: 850;
}

.comparison-head > div {
  border-color: rgba(255, 250, 240, 0.2);
  line-height: 1.35;
}

.matrix-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 30px;
}

.matrix-card {
  min-height: 230px;
  padding: 22px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.matrix-card p {
  color: var(--muted);
  line-height: 1.65;
}

.piece-atlas-section {
  border-top: 1px solid var(--line);
  background: #fbf7ee;
}

.piece-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 30px;
}

.piece-card {
  padding: 24px;
  border: 1px solid var(--line);
  background: var(--surface);
}

.piece-card h3 {
  margin-bottom: 18px;
}

.piece-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.piece-list li {
  display: grid;
  grid-template-columns: 62px minmax(120px, 0.42fr) minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.piece-icon {
  position: relative;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  justify-self: start;
  border: 2px solid var(--ink);
  background: #e4b96f;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 900;
  line-height: 1;
  text-align: center;
  box-shadow: inset 0 -5px 0 rgba(17, 20, 17, 0.08);
}

.piece-image {
  display: block;
  width: 64px;
  height: 64px;
  justify-self: start;
  border: 1px solid var(--line);
  background: #fff;
  object-fit: contain;
  padding: 3px;
}

.piece-icon.shogi {
  clip-path: polygon(50% 0, 91% 24%, 82% 100%, 18% 100%, 9% 24%);
  padding-top: 8px;
  font-size: 1.32rem;
  writing-mode: vertical-rl;
}

.piece-icon.chess {
  border: 0;
  background:
    linear-gradient(180deg, #fffaf0 0 55%, #e7d9bd 56% 100%);
  border-radius: 50% 50% 46% 46%;
  color: #151814;
  font-size: 2.5rem;
  box-shadow:
    inset 0 -6px 0 rgba(17, 20, 17, 0.12),
    0 0 0 2px var(--ink);
}

.piece-icon.round {
  border-radius: 50%;
  background: #f4d18f;
  box-shadow:
    inset 0 0 0 5px rgba(255, 250, 240, 0.42),
    inset 0 -5px 0 rgba(17, 20, 17, 0.08);
}

.piece-icon.red {
  color: var(--red);
  border-color: var(--red);
}

.piece-icon.blue {
  color: var(--blue);
  border-color: var(--blue);
}

.piece-icon.crown,
.piece-icon.seed,
.piece-icon.guard,
.piece-icon.horse,
.piece-icon.tower,
.piece-icon.elephant,
.piece-icon.pawn {
  border-radius: 8px 8px 14px 14px;
  background: linear-gradient(180deg, #f4d394, #d59f57);
  font-size: 0.95rem;
}

.piece-icon.crown::before,
.piece-icon.guard::before,
.piece-icon.tower::before,
.piece-icon.horse::before,
.piece-icon.elephant::before,
.piece-icon.seed::before,
.piece-icon.pawn::before {
  position: absolute;
  top: 5px;
  left: 50%;
  width: 24px;
  height: 8px;
  transform: translateX(-50%);
  background: var(--ink);
  content: "";
}

.piece-icon.crown::before {
  clip-path: polygon(0 100%, 16% 25%, 35% 100%, 50% 0, 65% 100%, 84% 25%, 100% 100%);
}

.piece-icon.guard::before {
  border-radius: 0 0 10px 10px;
}

.piece-icon.tower::before {
  clip-path: polygon(0 0, 18% 0, 18% 45%, 40% 45%, 40% 0, 60% 0, 60% 45%, 82% 45%, 82% 0, 100% 0, 100% 100%, 0 100%);
}

.piece-icon.horse::before {
  width: 22px;
  height: 16px;
  border-radius: 70% 35% 35% 30%;
  transform: translateX(-45%) rotate(-16deg);
}

.piece-icon.elephant::before {
  width: 25px;
  height: 15px;
  border-radius: 50% 50% 44% 44%;
}

.piece-icon.seed::before,
.piece-icon.pawn::before {
  width: 14px;
  height: 14px;
  border-radius: 50%;
}

.piece-icon.promoted {
  background: linear-gradient(180deg, #f8e0a1, #c98542);
}

.piece-list strong {
  line-height: 1.45;
}

.piece-list span {
  color: var(--muted);
  line-height: 1.65;
}

.move-diagram {
  --move-grid-size: 5;
  display: grid;
  grid-template-columns: repeat(var(--move-grid-size), 18px);
  grid-template-rows: repeat(var(--move-grid-size), 18px);
  gap: 2px;
  align-self: start;
  padding: 7px;
  border: 1px solid var(--line);
  background: #f5ead7;
}

.move-diagram small {
  grid-column: 1 / -1;
  max-width: calc((18px * var(--move-grid-size)) + (2px * (var(--move-grid-size) - 1)));
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.65rem;
  line-height: 1.35;
}

.move-cell {
  display: grid;
  width: 18px;
  height: 18px;
  place-items: center;
  border: 1px solid rgba(17, 20, 17, 0.14);
  background: rgba(255, 250, 240, 0.72);
  color: transparent;
  font-size: 0.56rem;
  font-weight: 850;
  line-height: 1;
}

.move-cell.origin {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--surface);
}

.move-cell.move {
  background: #79b394;
  border-color: #2f7259;
}

.move-cell.capture {
  background: #d98976;
  border-color: #a84c39;
}

.move-cell.ray {
  background:
    radial-gradient(circle, #25664f 0 38%, transparent 40%),
    rgba(121, 179, 148, 0.28);
  border-style: dashed;
  border-color: #3d8067;
}

.play-page {
  min-height: calc(100vh - 72px);
}

.play-hero {
  padding: clamp(42px, 6vw, 74px) clamp(20px, 4vw, 64px) 24px;
}

.play-hero h1 {
  max-width: 980px;
  font-size: clamp(2.9rem, 6vw, 6.2rem);
}

.shogi-app {
  display: grid;
  grid-template-columns: minmax(190px, 0.32fr) minmax(420px, 0.92fr) minmax(190px, 0.32fr);
  gap: 18px;
  align-items: start;
  padding: 20px clamp(20px, 4vw, 64px) clamp(56px, 7vw, 92px);
}

.player-panel,
.board-area {
  border: 1px solid var(--line);
  background: var(--surface);
}

.player-panel {
  min-height: 360px;
  padding: 18px;
}

.player-panel h2 {
  margin-bottom: 16px;
  font-size: 1.8rem;
}

.hand {
  display: grid;
  gap: 8px;
}

.hand-piece {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  width: 100%;
  border: 1px solid var(--line);
  background: #fbf7ee;
  padding: 7px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.hand-piece[disabled] {
  cursor: default;
  opacity: 0.42;
}

.hand-piece.active {
  border-color: var(--ink);
  background: #e9d7b5;
}

.hand-piece img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.hand-piece strong {
  font-size: 0.88rem;
}

.hand-piece span {
  color: var(--muted);
  font-weight: 850;
}

.board-area {
  padding: clamp(12px, 2vw, 18px);
}

.game-status,
.board-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.game-status {
  min-height: 48px;
  margin-bottom: 12px;
  color: var(--muted);
}

.turn-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--surface);
  padding: 0 12px;
  font-weight: 850;
}

.shogi-play-board {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(0, 1fr));
  width: min(100%, 760px);
  aspect-ratio: 1 / 1;
  margin-inline: auto;
  border: 2px solid #2f3528;
  background: #2f3528;
  gap: 0;
}

.shogi-square {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  border: 0;
  background: #eeeed2;
  cursor: pointer;
  line-height: 0;
  padding: 0;
}

.shogi-square.dark {
  background: #769656;
}

.shogi-square.selected {
  outline: 4px solid #1d6c57;
  outline-offset: -4px;
}

.shogi-square.legal::after,
.shogi-square.capture::after {
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: rgba(29, 108, 87, 0.52);
  content: "";
  pointer-events: none;
}

.shogi-square.capture::after {
  inset: 9%;
  border: 4px solid rgba(183, 53, 53, 0.82);
  background: transparent;
}

.shogi-piece {
  position: relative;
  z-index: 1;
  display: block;
  width: 116%;
  height: 116%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 3px 2px rgba(17, 20, 17, 0.24));
}

.shogi-piece.white {
  transform: rotate(180deg);
}

.shogi-square.last-move {
  box-shadow: inset 0 0 0 5px rgba(198, 147, 88, 0.72);
}

.board-actions {
  margin-top: 14px;
  justify-content: center;
}

.rule-note {
  max-width: 780px;
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.65;
}

.promotion-dialog {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: rgba(17, 20, 17, 0.42);
  padding: 20px;
}

.promotion-dialog[hidden] {
  display: none;
}

.promotion-card {
  width: min(100%, 420px);
  border: 1px solid var(--ink);
  background: var(--surface);
  padding: 24px;
  box-shadow: var(--shadow);
}

.promotion-card h2 {
  margin-bottom: 10px;
  font-size: 2rem;
}

.promotion-card div {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.shogi-chess-page {
  min-height: calc(100vh - 72px);
  background:
    linear-gradient(90deg, rgba(51, 96, 67, 0.18) 0 2px, transparent 2px 100%),
    linear-gradient(0deg, rgba(119, 150, 84, 0.2) 0 1px, transparent 1px 100%),
    repeating-linear-gradient(90deg, #c8c184 0 108px, #bcb372 108px 112px, #d4cb8b 112px 220px);
  background-size: 112px 100%, 100% 18px, 220px 100%;
}

.shogi-chess-stage {
  display: grid;
  gap: 14px;
  padding: clamp(18px, 3vw, 32px) clamp(16px, 4vw, 64px) clamp(32px, 6vw, 64px);
}

.shogi-chess-topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.48fr);
  gap: 18px;
  align-items: end;
}

.shogi-chess-topbar h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 3.2vw, 3.5rem);
  line-height: 1.04;
}

.shogi-chess-status {
  display: grid;
  gap: 8px;
  justify-items: end;
  color: #353a31;
  font-weight: 750;
}

.tatami-table {
  display: grid;
  grid-template-columns: minmax(360px, 720px);
  gap: clamp(12px, 2vw, 20px);
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.shogi-chess-board-wrap {
  width: min(100%, max(420px, calc(100vh - 230px)), 720px);
  padding: clamp(10px, 1.6vw, 16px);
  border: 1px solid rgba(72, 45, 20, 0.55);
  background:
    linear-gradient(90deg, rgba(84, 48, 14, 0.12), transparent 18%, rgba(255, 248, 214, 0.16) 50%, transparent 78%, rgba(84, 48, 14, 0.12)),
    repeating-linear-gradient(90deg, #c98d47 0 19px, #dba75c 19px 43px, #bd7d39 43px 58px);
  box-shadow:
    0 26px 44px rgba(42, 35, 20, 0.32),
    inset 0 0 0 5px rgba(255, 236, 168, 0.18);
}

.shogi-chess-board {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  grid-template-rows: repeat(8, minmax(0, 1fr));
  aspect-ratio: 1 / 1;
  border: 3px solid #1b160f;
  background: #1b160f;
  gap: 2px;
}

.shogi-chess-square {
  position: relative;
  display: grid;
  min-width: 0;
  min-height: 0;
  place-items: center;
  overflow: hidden;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.shogi-chess-square.light {
  background:
    linear-gradient(90deg, rgba(84, 48, 14, 0.08), transparent 28%, rgba(255, 248, 220, 0.2) 54%, transparent 82%),
    #e5bd78;
}

.shogi-chess-square.dark {
  background:
    linear-gradient(90deg, rgba(34, 28, 17, 0.16), transparent 36%, rgba(255, 248, 220, 0.12) 64%, transparent 88%),
    #b47a3c;
}

.shogi-chess-square.selected {
  outline: 4px solid #1d6c57;
  outline-offset: -4px;
}

.shogi-chess-square.last-move {
  box-shadow: inset 0 0 0 5px rgba(255, 244, 186, 0.48);
}

.shogi-chess-square.legal::after,
.shogi-chess-square.capture::after {
  position: absolute;
  inset: 36%;
  border-radius: 50%;
  background: rgba(29, 108, 87, 0.5);
  content: "";
  pointer-events: none;
}

.shogi-chess-square.capture::after {
  inset: 8%;
  border: 4px solid rgba(146, 38, 28, 0.78);
  background: transparent;
}

.shogi-chess-piece {
  position: relative;
  z-index: 1;
  width: 86%;
  height: 86%;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 6px 4px rgba(20, 14, 8, 0.32));
}

.shogi-chess-piece.black {
  transform: rotate(180deg);
}

.shogi-chess-controls,
.piece-key {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.engine-control {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(17, 20, 17, 0.32);
  background: rgba(255, 250, 240, 0.82);
  padding: 0 10px;
  font-weight: 750;
}

.engine-control span {
  color: #3c4437;
  font-size: 0.86rem;
}

.engine-control select {
  min-height: 30px;
  border: 1px solid rgba(17, 20, 17, 0.22);
  background: #fffaf0;
  color: var(--ink);
  font: inherit;
}

.piece-key {
  color: #2c332b;
}

.piece-key span {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(17, 20, 17, 0.16);
  background: rgba(255, 250, 240, 0.76);
  padding: 0 12px;
}

.piece-key strong {
  font-size: 1.18rem;
}

.piece-key a {
  display: inline-flex;
  min-height: 36px;
  align-items: center;
  border: 1px solid rgba(17, 20, 17, 0.16);
  background: rgba(255, 250, 240, 0.76);
  padding: 0 12px;
  font-weight: 850;
}

.license-hero,
.license-section {
  padding: clamp(48px, 7vw, 88px) clamp(20px, 4vw, 64px);
}

.license-hero {
  border-bottom: 1px solid var(--line);
}

.license-hero h1 {
  font-size: clamp(2.8rem, 6vw, 6rem);
}

.license-section {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.license-card {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
}

.license-card h2 {
  font-size: 2rem;
}

.license-card p,
.license-card li {
  color: var(--muted);
  line-height: 1.7;
}

.license-card a {
  color: var(--green);
  font-weight: 850;
  text-decoration: underline;
}

@media (max-width: 900px) {
  .site-header {
    min-height: 64px;
  }

  .nav-links {
    display: none;
  }

  .hero,
  .arena-section,
  .compare-controls,
  .shogi-app,
  .shogi-chess-topbar,
  .tatami-table {
    grid-template-columns: 1fr;
  }

  .shogi-chess-status {
    justify-items: start;
  }

  .player-panel {
    min-height: auto;
  }

  .player-panel-top {
    order: 1;
  }

  .board-area {
    order: 2;
  }

  .player-panel-bottom {
    order: 3;
  }

  .hand {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero {
    min-height: auto;
    padding-top: 42px;
  }

  .arena-preview {
    justify-self: stretch;
  }

  .lineage-grid,
  .principle-grid,
  .matrix-grid,
  .piece-grid,
  .structure-map,
  .license-section {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    justify-content: flex-start;
  }

  .comparison-row {
    grid-template-columns: 1fr;
  }

  .comparison-row > div {
    border-right: 0;
  }

  .piece-list li {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .waitlist-section {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 520px) {
  .site-header {
    padding-inline: 16px;
  }

  .brand span:last-child {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .nav-cta {
    min-height: 38px;
    padding-inline: 12px;
    font-size: 0.84rem;
  }

  h1 {
    font-size: 3.05rem;
  }

  .hero,
  .lineage-section,
  .section-band,
  .arena-section,
  .vision-section,
  .waitlist-section,
  .compare-hero,
  .compare-controls,
    .comparison-section,
    .game-matrix-section,
    .piece-atlas-section,
    .play-hero,
    .shogi-app,
    .shogi-chess-stage,
    .license-hero,
    .license-section {
    padding-inline: 16px;
  }

  .shogi-app {
    padding-top: 10px;
  }

  .hand {
    grid-template-columns: 1fr;
  }

  .shogi-play-board {
    border-width: 2px;
  }

  .shogi-piece {
    width: 118%;
    height: 118%;
  }

  .shogi-chess-board {
    gap: 1px;
    border-width: 2px;
  }

  .shogi-chess-piece {
    width: 96%;
    height: 96%;
  }

  .signup-form div {
    align-items: stretch;
    flex-direction: column;
  }
}
