/* Joc de Table — scena jocului e întunecată (lemn pe postav verde), conținutul de dedesubt e pe hârtie caldă. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/fraunces-latin-ext-600-normal.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/fraunces-latin-600-normal.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  --stage-1: #10291f;
  --stage-2: #081812;
  --stage-ink: #f3ead8;
  --stage-muted: rgba(243, 234, 216, 0.62);
  --stage-line: rgba(243, 234, 216, 0.1);
  --gold: #f2c96b;
  --gold-2: #d79f3c;
  --go: #6fd3a0;

  --felt-1: #24604a;
  --felt-2: #163f30;
  --pt-a1: #f1e4c4;
  --pt-a2: #d9c296;
  --pt-b1: #a8392f;
  --pt-b2: #78231e;

  --paper: #f8f3ea;
  --paper-2: #efe7d8;
  --ink: #221b14;
  --muted: #6c6153;
  --line: #e2d7c4;
  --accent: #9b3328;
  --link: #8a2c22;

  --r: 14px;
  --shadow-board: 0 2px 0 rgba(255, 220, 170, 0.08) inset, 0 40px 80px -30px rgba(0, 0, 0, 0.75), 0 18px 30px -18px rgba(0, 0, 0, 0.6);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #15130f;
    --paper-2: #1d1a15;
    --ink: #ece4d6;
    --muted: #a99d8b;
    --line: #2f2a22;
    --accent: #e0846f;
    --link: #f0a48f;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  background: var(--stage-2);
}

body {
  margin: 0;
  font: 16px/1.55 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

a {
  color: var(--link);
}

.skip {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 100;
  background: var(--gold);
  color: #000;
  padding: 8px 12px;
  border-radius: 8px;
}
.skip:focus {
  left: 8px;
}

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

.wrap {
  width: min(100% - 32px, 760px);
  margin-inline: auto;
}

.muted {
  color: var(--muted);
}
.small {
  font-size: 13.5px;
}

/* --- bara de sus ----------------------------------------------------------------------------- */
.topbar {
  position: relative;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  background: var(--stage-1);
  color: var(--stage-ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.7);
}
.brand-name {
  font: 600 21px/1 var(--serif);
  letter-spacing: -0.01em;
}
.brand-name b {
  font-weight: 600;
  color: var(--gold);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.chip,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 38px;
  border: 1px solid var(--stage-line);
  background: rgba(255, 255, 255, 0.05);
  color: var(--stage-ink);
  border-radius: 999px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.chip {
  padding: 0 14px 0 10px;
  font-weight: 600;
  font-size: 14.5px;
}
.icon-btn {
  width: 38px;
}
.chip:hover,
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}
.chip:active,
.icon-btn:active {
  transform: scale(0.96);
}
.chip svg,
.icon-btn svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-btn .i-off {
  display: none;
}
.icon-btn.muted .i-on {
  display: none;
}
.icon-btn.muted .i-off {
  display: block;
}

/* --- scena ------------------------------------------------------------------------------------ */
.stage {
  position: relative;
  color: var(--stage-ink);
  background:
    radial-gradient(1200px 520px at 50% 34%, rgba(46, 120, 88, 0.42), transparent 70%),
    radial-gradient(900px 400px at 50% 110%, rgba(0, 0, 0, 0.5), transparent 70%),
    linear-gradient(180deg, var(--stage-1), var(--stage-2));
  padding: 4px 10px 18px;
  overflow: hidden;
}
.stage::after {
  content: '';
  position: absolute;
  inset: auto 0 0;
  height: 26px;
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.18));
  pointer-events: none;
}

.stage-inner {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 24px;
}

.game {
  /* tabla cât mai mare, dar cu tot jocul vizibil pe ecran */
  width: min(100%, calc((100svh - 300px) * 1.3314), 1060px);
  min-width: min(100%, 300px);
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.game-meta {
  display: flex;
  justify-content: center;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--stage-muted);
  min-height: 18px;
}

.pbar {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--stage-line);
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.pbar.active {
  border-color: rgba(242, 201, 107, 0.55);
  background: rgba(242, 201, 107, 0.08);
  box-shadow: 0 0 0 3px rgba(242, 201, 107, 0.08);
}
.pchk {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}
.pchk.c0,
.dot.c0 {
  background: radial-gradient(circle at 38% 32%, #fffdf6, #efe3c9 55%, #cdb98f);
  border: 1px solid #a8946c;
}
.pchk.c1,
.dot.c1 {
  background: radial-gradient(circle at 38% 30%, #5a504a, #2b2522 50%, #110d0b);
  border: 1px solid #000;
}
.pname {
  font-weight: 650;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.pbar.active .pname::after {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 8px;
  vertical-align: 2px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(242, 201, 107, 0.6);
  animation: ping 1.6s infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(242, 201, 107, 0.55); }
  70% { box-shadow: 0 0 0 8px rgba(242, 201, 107, 0); }
  100% { box-shadow: 0 0 0 0 rgba(242, 201, 107, 0); }
}
.pmeta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-variant-numeric: tabular-nums;
}
.ppip {
  font-size: 13.5px;
  color: var(--stage-muted);
}
.ppip::after {
  content: ' pip';
}
.pscore {
  min-width: 30px;
  height: 26px;
  padding: 0 8px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.3);
  font: 600 16px/1 var(--serif);
  color: var(--gold);
}

/* --- tabla ------------------------------------------------------------------------------------ */
.board-wrap {
  position: relative;
}
.board-host {
  position: relative;
  width: 100%;
  aspect-ratio: 900 / 676;
  border-radius: 1.8% / 2.4%;
  box-shadow: var(--shadow-board);
  background:
    linear-gradient(90deg, transparent 2.4%, #1d4a38 2.4%, #1d4a38 42.4%, transparent 42.4%, transparent 48.2%, #1d4a38 48.2%, #1d4a38 88.2%, transparent 88.2%) 0 3.25% / 100% 93.5% no-repeat,
    linear-gradient(135deg, #7a4a2a, #4a2b18);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.board-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  border-radius: inherit;
}
.board-host.can-drag .board-svg {
  touch-action: none;
}
.b-numbers text {
  font: 600 12.5px var(--sans);
  fill: rgba(255, 233, 196, 0.55);
  pointer-events: none;
}
.b-checkers,
.b-labels,
.b-hl-over,
.b-hl-under,
.b-last,
.b-cube,
.b-arrows {
  pointer-events: none;
}
.chk .slab {
  display: none;
}
.chk.off .disc {
  display: none;
}
.chk.off .slab {
  display: inline;
}
.cnt {
  font: 700 21px var(--sans);
}
.cnt.c0 {
  fill: #6a5634;
}
.cnt.c1 {
  fill: #f1e6cf;
}
.cnt-off {
  font: 700 15px var(--sans);
  fill: rgba(255, 233, 196, 0.8);
}
.ring-movable {
  fill: none;
  stroke: rgba(242, 201, 107, 0.7);
  stroke-width: 2.4;
  animation: breathe 1.8s ease-in-out infinite;
}
.ring-selected {
  fill: none;
  stroke: var(--gold);
  stroke-width: 4.5;
}
@keyframes breathe {
  0%, 100% { stroke-opacity: 0.25; }
  50% { stroke-opacity: 0.85; }
}
.hl-point {
  animation: glow 1.3s ease-in-out infinite;
}
@keyframes glow {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}
.dot-target {
  fill: rgba(242, 201, 107, 0.34);
  stroke: var(--gold);
  stroke-width: 3;
  stroke-dasharray: 7 5;
  animation: spin-dash 6s linear infinite;
}
@keyframes spin-dash {
  to { stroke-dashoffset: -120; }
}
.dot-target.hit {
  fill: rgba(255, 120, 90, 0.28);
  stroke: #ff8a66;
}
.hl-tray {
  fill: rgba(242, 201, 107, 0.16);
  stroke: var(--gold);
  stroke-width: 2.5;
  animation: glow 1.3s ease-in-out infinite;
}
.ghost {
  fill: none;
  stroke-width: 2.4;
  stroke-dasharray: 5 5;
}
.ghost.c0 {
  stroke: rgba(246, 238, 220, 0.75);
}
.ghost.c1 {
  stroke: rgba(10, 8, 6, 0.75);
}
.cube-num {
  font: 600 24px var(--serif);
  fill: #3b2c17;
}
.cube-num.small {
  font-size: 19px;
}
.cube.offered {
  animation: cube-pop 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
  transform-box: fill-box;
}
@keyframes cube-pop {
  from { opacity: 0; }
  to { opacity: 1; }
}
.kb-focus {
  fill: none;
  stroke: #fff;
  stroke-width: 3;
  stroke-dasharray: 4 4;
  pointer-events: none;
}
.board-host:focus {
  outline: none;
}
.board-host:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}
.hint-arrow-bg {
  fill: none;
  stroke: rgba(4, 30, 20, 0.75);
  stroke-width: 9;
  stroke-linecap: round;
}
.hint-arrow {
  fill: none;
  stroke: var(--go);
  stroke-width: 5;
  stroke-linecap: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw 0.6s ease forwards;
  opacity: 0.92;
}
@keyframes draw {
  to { stroke-dashoffset: 0; }
}
.hint-dot {
  fill: var(--go);
}
.hint-num {
  font: 800 12px var(--sans);
  fill: #0d2a1e;
}

/* --- zaruri 3D --------------------------------------------------------------------------------- */
.dice-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.die {
  --s: var(--die, 46px);
  position: absolute;
  width: var(--s);
  height: var(--s);
  transform: translate(-50%, -50%) rotate(var(--tilt, 0deg));
  perspective: 700px;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 0.25s, filter 0.25s;
}
.die.small {
  --s: calc(var(--die, 46px) * 0.84);
}
.die::before {
  content: '';
  position: absolute;
  inset: 14% -10% -18% 8%;
  border-radius: 30%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent);
  filter: blur(2px);
}
.die-cube {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
}
.die-face {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 15%;
  border-radius: 20%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.die.light .die-face {
  background: radial-gradient(circle at 30% 25%, #fffef9, #f1e8d6 60%, #ddd0b6);
  box-shadow: inset 0 0 0 1px rgba(120, 95, 55, 0.25), inset 0 -3px 5px rgba(120, 95, 55, 0.25);
}
.die.dark .die-face {
  background: radial-gradient(circle at 30% 25%, #4b413c, #231d1a 60%, #120e0c);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.6), inset 0 2px 3px rgba(255, 255, 255, 0.08);
}
.pip {
  width: 76%;
  aspect-ratio: 1;
  place-self: center;
  border-radius: 50%;
}
.die.light .pip {
  background: radial-gradient(circle at 40% 35%, #4a3c34, #120c09);
  box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.6);
}
.die.dark .pip {
  background: radial-gradient(circle at 40% 35%, #fffaf0, #d8c9a8);
}
.die-face.f1 { transform: rotateY(0deg) translateZ(calc(var(--s) / 2)); }
.die-face.f6 { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.die-face.f2 { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); }
.die-face.f5 { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.die-face.f3 { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); }
.die-face.f4 { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.die.used {
  opacity: 0.36;
  filter: saturate(0.4);
}

/* --- mesaje pe tablă --------------------------------------------------------------------------- */
.toast {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 3;
  max-width: 86%;
  padding: 10px 18px;
  border-radius: 999px;
  background: rgba(16, 12, 9, 0.84);
  color: #fff7e6;
  font-weight: 600;
  font-size: clamp(13px, 2.2vw, 16px);
  text-align: center;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.7);
  transform: translate(-50%, -50%) scale(0.92);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s cubic-bezier(0.3, 1.5, 0.5, 1);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.board-overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 4%;
  border-radius: inherit;
  background: rgba(6, 18, 13, 0.5);
  -webkit-backdrop-filter: blur(1.5px);
  backdrop-filter: blur(1.5px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0s 0.25s;
}
.board-overlay.show {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.25s;
}
.ov-card {
  width: min(100%, 440px);
  padding: clamp(16px, 3.5vw, 28px);
  border-radius: 18px;
  background: linear-gradient(180deg, #fbf6ec, #f1e7d4);
  color: #241c13;
  text-align: center;
  box-shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255, 255, 255, 0.6) inset;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.board-overlay.show .ov-card {
  transform: none;
}
.ov-title {
  color: #241c13;
  margin: 0 0 6px;
  font: 600 clamp(22px, 4.4vw, 32px) / 1.1 var(--serif);
  letter-spacing: -0.01em;
}
.board-overlay.win .ov-title {
  color: #1c5a40;
}
.board-overlay.lose .ov-title {
  color: #7e2a22;
}
.ov-text {
  margin: 0 0 16px;
  color: #5d5142;
  font-size: clamp(13.5px, 2.2vw, 15.5px);
}
.ov-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.noscript {
  position: absolute;
  inset: 40% 10% auto;
  text-align: center;
  color: #fff;
}

.confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 5;
  border-radius: inherit;
}
.confetti i {
  position: absolute;
  top: -12px;
  width: 8px;
  height: 13px;
  border-radius: 2px;
  animation: fall linear forwards;
}
@keyframes fall {
  to {
    transform: translate(var(--dx), 110cqh) translateY(700px) rotate(var(--r));
    opacity: 0.2;
  }
}

/* --- butoane de control ------------------------------------------------------------------------ */
.controls {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  margin-top: 2px;
}
.ctl {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-width: 52px;
  height: 54px;
  padding: 0 14px;
  border-radius: 14px;
  border: 1px solid var(--stage-line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--stage-ink);
  font-weight: 650;
  font-size: 15px;
  transition: background 0.15s, transform 0.1s, opacity 0.2s, box-shadow 0.2s;
}
.ctl svg {
  width: 22px;
  height: 22px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ctl svg .f {
  fill: currentColor;
  stroke: none;
}
.ctl:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.11);
}
.ctl:active:not(:disabled) {
  transform: scale(0.97);
}
.ctl:disabled {
  opacity: 0.38;
  cursor: default;
}
.ctl.main {
  font-size: 16.5px;
  color: #2a1b06;
  border: 0;
  background: linear-gradient(180deg, #f8d77f, var(--gold-2));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 10px 24px -10px rgba(242, 201, 107, 0.8);
}
.ctl.main:hover:not(:disabled) {
  background: linear-gradient(180deg, #fde3a0, #e2ab4a);
}
.ctl.main.is-confirm {
  color: #06281a;
  background: linear-gradient(180deg, #8ee6b9, #3fb77e);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 10px 24px -10px rgba(111, 211, 160, 0.9);
  animation: nudge 1.8s ease-in-out infinite;
}
@keyframes nudge {
  0%, 100% { transform: none; }
  50% { transform: translateY(-1px); }
}
.ctl.main span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ctl.main.is-waiting svg,
.ctl.main:disabled svg {
  display: none;
}
.ctl.main.is-waiting {
  color: var(--stage-ink);
  background: rgba(255, 255, 255, 0.05);
  border: 1px dashed rgba(243, 234, 216, 0.22);
  box-shadow: none;
  opacity: 1;
}
.ctl.main:disabled:not(.is-waiting) {
  opacity: 0.55;
}
.dbl-val {
  font: 600 17px/1 var(--serif);
  color: var(--gold);
}
.status {
  margin: 2px 4px 0;
  min-height: 2.6em;
  font-size: 14px;
  line-height: 1.35;
  color: var(--stage-muted);
  text-align: center;
}

.side {
  display: none;
  width: 262px;
  flex: none;
  padding-top: 26px;
}
.side-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--stage-muted);
}
.history {
  list-style: none;
  margin: 0;
  padding: 0 6px 0 0;
  max-height: calc(100svh - 260px);
  overflow: auto;
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
  scrollbar-width: thin;
  scrollbar-color: rgba(243, 234, 216, 0.2) transparent;
}
.history li {
  display: flex;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--stage-ink);
}
.history li:nth-child(odd) {
  background: rgba(255, 255, 255, 0.035);
}
.history li b {
  flex: none;
  width: 96px;
  font-weight: 650;
  color: var(--stage-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history li b::before {
  content: '';
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: 0;
}
.history li.h-0 b::before {
  background: #efe3c9;
}
.history li.h-1 b::before {
  background: #2b2522;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.35);
}
.side-empty {
  margin: 0;
  font-size: 13.5px;
  color: var(--stage-muted);
}
.rail {
  display: none;
  width: 300px;
  flex: none;
  padding-top: 64px;
}

/* --- intro și conținut --------------------------------------------------------------------------- */
.intro {
  background: var(--paper);
  padding: 34px 0 6px;
}
h1,
h2,
h3 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.15;
  color: var(--ink);
}
.intro h1 {
  margin: 0 0 10px;
  font-size: clamp(32px, 6vw, 46px);
}
.lead {
  margin: 0 0 20px;
  font-size: 18.5px;
  color: var(--muted);
}
.perks {
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.perks li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-2);
  font-size: 14px;
  color: var(--muted);
}
.perks b {
  display: block;
  font-size: 15.5px;
  color: var(--ink);
}
.howto {
  padding: 16px 18px;
  border-radius: 14px;
  border-left: 4px solid var(--accent);
  background: var(--paper-2);
}
.howto p {
  margin: 0;
  font-size: 15.5px;
}
.h-small {
  margin: 0 0 6px;
  font-size: 20px;
}
kbd {
  display: inline-block;
  min-width: 1.6em;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  background: var(--paper);
  font: 600 12.5px/1.6 var(--sans);
  text-align: center;
}

.content {
  padding: 18px 0 40px;
  font-size: 17px;
  line-height: 1.68;
}
.content h2 {
  margin: 46px 0 12px;
  font-size: clamp(26px, 4.6vw, 34px);
}
.content h3 {
  margin: 28px 0 6px;
  font-size: 21px;
}
.content p,
.content ul,
.content ol {
  margin: 0 0 14px;
}
.content ul,
.content ol {
  padding-left: 1.3em;
}
.content li {
  margin-bottom: 6px;
}
.note {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--paper-2);
  color: var(--muted);
  font-size: 15.5px;
}
.fig {
  margin: 18px 0 22px;
}
.fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
}
.fig figcaption {
  margin-top: 8px;
  font-size: 14.5px;
  color: var(--muted);
  text-align: center;
}
.tips li::marker {
  font-family: var(--serif);
  color: var(--accent);
  font-weight: 600;
}
.table-scroll {
  overflow-x: auto;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.tbl {
  width: 100%;
  border-collapse: collapse;
  font-size: 15.5px;
}
.tbl th,
.tbl td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.tbl thead th {
  background: var(--paper-2);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.tbl tbody tr:last-child td {
  border-bottom: 0;
}
.tbl td:last-child {
  color: var(--muted);
}
.openings td:first-child {
  font: 600 17px var(--serif);
  white-space: nowrap;
}
.openings td:nth-child(2) {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  font-weight: 600;
}
.glossary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.glossary div {
  display: grid;
  grid-template-columns: 9.5em 1fr;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.glossary div:last-child {
  border-bottom: 0;
}
.glossary dt {
  font-weight: 700;
}
.glossary dd {
  margin: 0;
  color: var(--muted);
}
.faq details {
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 10px;
  background: var(--paper);
}
.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 14px 44px 14px 16px;
  font-weight: 650;
  position: relative;
}
.faq summary::-webkit-details-marker {
  display: none;
}
.faq summary::after {
  content: '+';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font: 400 24px/1 var(--sans);
  color: var(--accent);
  transition: transform 0.2s;
}
.faq details[open] summary::after {
  transform: translateY(-50%) rotate(45deg);
}
.faq details p {
  margin: 0;
  padding: 0 16px 14px;
  color: var(--muted);
}
.cta-line {
  margin-top: 30px;
  text-align: center;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 46px;
  padding: 0 22px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  font-size: 15.5px;
  text-decoration: none;
  transition: transform 0.1s, background 0.15s;
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  color: #2a1b06;
  background: linear-gradient(180deg, #f8d77f, var(--gold-2));
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.6) inset, 0 8px 20px -10px rgba(180, 120, 30, 0.9);
}
.btn-ghost {
  color: inherit;
  background: transparent;
  border-color: rgba(60, 45, 25, 0.25);
}
.btn-block {
  width: 100%;
}
.btn-small {
  height: 36px;
  padding: 0 14px;
  font-size: 14px;
}

/* --- reclame (ascunse până la configurare) -------------------------------------------------------- */
.ad[hidden] {
  display: none !important;
}
.ad {
  position: relative;
  display: block;
  margin: 24px auto;
  min-height: 100px;
  text-align: center;
}
.ad::before {
  content: 'Publicitate';
  display: block;
  margin-bottom: 4px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.ad-wide {
  min-height: 280px;
}
.rail .ad {
  position: sticky;
  top: 16px;
  min-height: 600px;
  margin: 0;
}
.rail .ad::before {
  color: var(--stage-muted);
}

/* --- subsol ------------------------------------------------------------------------------------- */
.footer {
  padding: 30px 0 calc(34px + var(--safe-b));
  border-top: 1px solid var(--line);
  background: var(--paper-2);
  font-size: 15px;
}
.footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 8px 0 12px;
}
.foot-brand {
  margin: 0;
  font-family: var(--serif);
  font-size: 18px;
}

/* --- dialoguri ---------------------------------------------------------------------------------- */
dialog.sheet {
  width: min(100% - 20px, 440px);
  max-height: min(92svh, 760px);
  padding: 18px 18px calc(18px + var(--safe-b));
  border: 0;
  border-radius: 20px;
  background: #fbf7ef;
  color: #221b14;
  box-shadow: 0 40px 80px -20px rgba(0, 0, 0, 0.6);
  overflow: auto;
}
dialog.sheet::backdrop {
  background: rgba(4, 12, 9, 0.6);
  -webkit-backdrop-filter: blur(3px);
  backdrop-filter: blur(3px);
}
dialog.sheet[open] {
  animation: sheet-in 0.32s cubic-bezier(0.2, 1, 0.3, 1);
}
@keyframes sheet-in {
  from { transform: translateY(24px); opacity: 0; }
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.sheet-head h2 {
  margin: 0;
  font-size: 26px;
  color: #221b14;
}
.sheet-sub {
  margin: 22px 0 8px;
  font-size: 18px;
  color: #221b14;
}
.x {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.06);
  font-size: 24px;
  line-height: 1;
}
.seg {
  border: 0;
  padding: 0;
  margin: 0 0 14px;
}
.seg legend {
  padding: 0;
  margin-bottom: 6px;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7a6d5c;
}
.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.seg legend {
  width: 100%;
}
.seg label {
  flex: 1 1 0;
  min-width: max-content;
}
.seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.seg label span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 44px;
  padding: 0 12px;
  border-radius: 11px;
  border: 1px solid #e0d5c2;
  background: #fff;
  font-weight: 650;
  font-size: 15px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.seg input:checked + span {
  border-color: #1d4a38;
  background: #1d4a38;
  color: #fff6e3;
  box-shadow: 0 6px 14px -8px rgba(29, 74, 56, 0.9);
}
.seg input:focus-visible + span {
  outline: 2.5px solid var(--gold-2);
  outline-offset: 2px;
}
.dot {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
}
.switch {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #ece3d3;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.sw {
  position: relative;
  flex: none;
  width: 46px;
  height: 28px;
  border-radius: 999px;
  background: #d8cdb9;
  transition: background 0.2s;
}
.sw::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.3, 1.4, 0.5, 1);
}
.switch input:checked + .sw {
  background: #2f7d5a;
}
.switch input:checked + .sw::after {
  transform: translateX(18px);
}
.switch input:focus-visible + .sw {
  outline: 2.5px solid var(--gold-2);
  outline-offset: 2px;
}
.sw-text {
  font-weight: 650;
  font-size: 15.5px;
}
.sw-text small {
  display: block;
  font-weight: 400;
  font-size: 13px;
  color: #7a6d5c;
}
.dlg-note {
  margin: -4px 0 12px;
  font-size: 13.5px;
  color: #8a5a1f;
}
#form-new .switch {
  margin-bottom: 16px;
}
.stats table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  margin-bottom: 12px;
}
.stats th,
.stats td {
  padding: 6px 4px;
  text-align: center;
  border-bottom: 1px solid #ece3d3;
}
.stats th:first-child {
  text-align: left;
}
.stats thead th {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #7a6d5c;
}
.stats .muted {
  color: #7a6d5c;
  font-size: 14.5px;
}

/* --- adaptări de ecran ---------------------------------------------------------------------------- */
@media (max-width: 520px) {
  .stage {
    padding: 2px 6px 12px;
  }
  .game {
    gap: 6px;
  }
  .topbar {
    padding-top: max(8px, env(safe-area-inset-top));
    padding-bottom: 6px;
  }
  .brand-mark {
    width: 30px;
    height: 30px;
  }
  .brand-name {
    font-size: 19px;
  }
  .chip span {
    display: none;
  }
  .chip {
    width: 38px;
    padding: 0;
  }
  .pbar {
    height: 36px;
    padding: 0 10px;
    border-radius: 10px;
  }
  .pname {
    font-size: 14px;
  }
  .ctl {
    height: 52px;
    padding: 0 12px;
  }
  .ctl:not(.main) span {
    display: none;
  }
  .ctl#btn-double {
    min-width: 56px;
  }
  .ctl#btn-double span {
    display: none;
  }
  .status {
    font-size: 13.5px;
  }
  .perks {
    grid-template-columns: 1fr 1fr;
  }
  .glossary div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .content {
    font-size: 16.5px;
  }
}

@media (min-width: 900px) {
  .stage {
    padding: 8px 20px 26px;
  }
  .game {
    width: min(100%, calc((100svh - 330px) * 1.3314), 1060px);
  }
  .game {
    gap: 9px;
  }
  .lead {
    font-size: 20px;
  }
  .perks {
    grid-template-columns: repeat(4, 1fr);
  }
}

/* telefon ținut orizontal: tabla în stânga, comenzile în dreapta */
@media (orientation: landscape) and (max-height: 560px) {
  .topbar {
    padding-top: 4px;
    padding-bottom: 4px;
  }
  .brand-mark {
    width: 26px;
    height: 26px;
  }
  .stage {
    padding: 0 max(10px, env(safe-area-inset-right)) 8px max(10px, env(safe-area-inset-left));
  }
  .game {
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: minmax(0, calc((100svh - 64px) * 1.3314)) minmax(200px, 1fr);
    grid-template-areas:
      'board top'
      'board bottom'
      'board ctl'
      'board status'
      'board meta';
    grid-template-rows: auto auto auto 1fr auto;
    column-gap: 14px;
    row-gap: 8px;
    align-items: start;
  }
  .board-wrap { grid-area: board; }
  .pbar.top { grid-area: top; }
  .pbar.bottom { grid-area: bottom; }
  .controls { grid-area: ctl; grid-template-columns: 1fr 1fr; }
  .controls .main { grid-column: 1 / -1; order: -1; }
  .status { grid-area: status; text-align: left; }
  .game-meta { grid-area: meta; justify-content: flex-start; }
  .ctl:not(.main) span { display: inline; }
}

@media (min-width: 1280px) and (min-height: 600px) {
  .side {
    display: block;
  }
  .stage-inner {
    padding-right: 274px;
  }
}

@media (min-width: 1400px) {
  .rail.has-ad {
    display: block;
  }
  .stage-inner:has(.rail.has-ad) {
    padding-right: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- pagini secundare -------------------------------------------------------------------------- */
.chip-link {
  text-decoration: none;
  padding: 0 16px;
}
.legal h1 {
  margin: 8px 0 4px;
  font-size: clamp(30px, 6vw, 42px);
}
.legal h2 {
  margin-top: 34px;
  font-size: 24px;
}
.crumbs {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
}
.crumbs a {
  color: inherit;
}
.page-404 {
  min-height: 100svh;
  display: grid;
  place-items: center;
  background: radial-gradient(900px 500px at 50% 30%, rgba(46, 120, 88, 0.45), transparent 70%), linear-gradient(180deg, var(--stage-1), var(--stage-2));
  color: var(--stage-ink);
}
.nf {
  max-width: 460px;
  padding: 24px;
  text-align: center;
}
.nf h1 {
  color: var(--stage-ink);
  font-size: clamp(28px, 6vw, 38px);
  margin: 18px 0 8px;
}
.nf p {
  color: var(--stage-muted);
}
.nf-dice {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.nf-dice span {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: radial-gradient(circle at 30% 25%, #fffef9, #f1e8d6 60%, #ddd0b6);
  color: #241c13;
  font: 600 34px var(--serif);
  box-shadow: 0 14px 24px -10px rgba(0, 0, 0, 0.7);
  transform: rotate(-6deg);
}
.nf-dice span:nth-child(2) {
  transform: rotate(5deg) translateY(-6px);
}
