/* Shared, declarative game cards. Kept scoped so chat styles cannot leak in. */
/* Palette: koyu-altın is the base; the other open themes override the same tokens below. */
.jiin-game {
    --jg-ink: #f3ece0;
    --jg-muted: #b5ac9d;
    --jg-accent: #dbb76f;
    --jg-heading: #e9d4ad;
    --jg-surface: linear-gradient(145deg, #2b2823, #1c1c1b 72%);
    --jg-border: #655238;
    --jg-shadow: #00000020;
    --jg-pill-border: #73654b;
    --jg-pill-bg: #ffffff08;
    --jg-turn-bg: #dbb76f20;
    --jg-turn-border: #dbb76f60;
    --jg-turn-ink: #eed49b;
    --jg-board: #10100f;
    --jg-board-edge: #ffffff0f;
    --jg-cell: #2e2b26;
    --jg-cell-alt: #39342c;
    --jg-cell-hover: #534731;
    --jg-cell-hover-edge: #dbb76f99;
    --jg-cell-selected: #665035;
    --jg-selected-edge: #e6c688;
    --jg-target-edge: #dbb76f5c;
    --jg-target-dot: #dbb76f70;
    --jg-preview: #6b5836;
    --jg-coordinate: #c4bbaa;
    --jg-user: #f0d7a5;
    --jg-jiin: #88c7d1;
    --jg-user-tint: #dbb76f12;
    --jg-jiin-tint: #76b9c412;
    --jg-point-edge: #806b48;
    --jg-connector: #9e8a69;
    --jg-dot: #e8cf9d;
    --jg-message: #d8cdbb;
    --jg-event-edge: #a28b5e;
    --jg-button-edge: #776445;
    --jg-button-bg: #ffffff05;
    --jg-button-ink: #e3d7c1;
    --jg-button-hover-edge: #e2c082;
    --jg-button-hover-bg: #dbb76f18;
    --jg-primary: #d9b977;
    --jg-primary-hover: #efcf8e;
    --jg-primary-ink: #231e15;
    --jg-focus: #f4daa7;
    --jg-error-edge: #bb825f66;
    --jg-error-bg: #9c533a1a;
    --jg-error-ink: #f5c6ae;
    box-sizing: border-box;
    width: min(100%, 460px);
    margin: 14px 0;
    padding: 18px;
    border: 1px solid var(--jg-border);
    border-radius: 20px;
    background: var(--jg-surface);
    color: var(--jg-ink);
    box-shadow: 0 12px 32px var(--jg-shadow);
    font-family: inherit;
    line-height: 1.5;
    overflow: hidden;
    isolation: isolate;
}
/* Siyah (Editorial Dark): black and white; Jiin takes the theme's single warm accent. */
html[data-tema="siyah"] .jiin-game {
    --jg-ink: #f5f5f0;
    --jg-muted: rgba(245,245,240,0.62);
    --jg-accent: #f5f5f0;
    --jg-heading: rgba(245,245,240,0.86);
    --jg-surface: #1a1a18;
    --jg-border: rgba(255,255,255,0.12);
    --jg-shadow: #00000040;
    --jg-pill-border: rgba(255,255,255,0.16);
    --jg-pill-bg: rgba(255,255,255,0.04);
    --jg-turn-bg: rgba(245,245,240,0.10);
    --jg-turn-border: rgba(245,245,240,0.35);
    --jg-turn-ink: #ffffff;
    --jg-board: #0d0d0c;
    --jg-board-edge: rgba(255,255,255,0.06);
    --jg-cell: #242421;
    --jg-cell-alt: #2d2d29;
    --jg-cell-hover: #3a3a35;
    --jg-cell-hover-edge: rgba(245,245,240,0.55);
    --jg-cell-selected: #45453f;
    --jg-selected-edge: #f5f5f0;
    --jg-target-edge: rgba(245,245,240,0.28);
    --jg-target-dot: rgba(245,245,240,0.45);
    --jg-preview: #4d4d47;
    --jg-coordinate: rgba(245,245,240,0.5);
    --jg-user: #f5f5f0;
    --jg-jiin: #ff8d7a;
    --jg-user-tint: rgba(245,245,240,0.08);
    --jg-jiin-tint: rgba(255,141,122,0.10);
    --jg-point-edge: rgba(245,245,240,0.3);
    --jg-connector: rgba(245,245,240,0.45);
    --jg-dot: #f5f5f0;
    --jg-message: rgba(245,245,240,0.82);
    --jg-event-edge: rgba(245,245,240,0.35);
    --jg-button-edge: rgba(255,255,255,0.16);
    --jg-button-bg: rgba(255,255,255,0.03);
    --jg-button-ink: #f5f5f0;
    --jg-button-hover-edge: rgba(245,245,240,0.6);
    --jg-button-hover-bg: rgba(245,245,240,0.08);
    --jg-primary: #f5f5f0;
    --jg-primary-hover: #ffffff;
    --jg-primary-ink: #111110;
    --jg-focus: #f5f5f0;
    --jg-error-edge: rgba(255,141,122,0.4);
    --jg-error-bg: rgba(255,141,122,0.08);
    --jg-error-ink: #ffb4a6;
}
/* Fildişi Klasik (hardal): light ivory board, gold for you and deep teal for Jiin. */
html[data-tema="hardal"] .jiin-game {
    --jg-ink: #29241b;
    --jg-muted: rgba(41,36,27,0.62);
    --jg-accent: #9a742c;
    --jg-heading: #5c4a2a;
    --jg-surface: #fffdf8;
    --jg-border: rgba(154,116,44,0.28);
    --jg-shadow: rgba(41,36,27,0.08);
    --jg-pill-border: rgba(41,36,27,0.14);
    --jg-pill-bg: rgba(41,36,27,0.03);
    --jg-turn-bg: rgba(154,116,44,0.12);
    --jg-turn-border: rgba(154,116,44,0.40);
    --jg-turn-ink: #7d5d20;
    --jg-board: #eadfc6;
    --jg-board-edge: rgba(41,36,27,0.08);
    --jg-cell: #f7f2e7;
    --jg-cell-alt: #efe5cf;
    --jg-cell-hover: #e8d9b5;
    --jg-cell-hover-edge: rgba(154,116,44,0.6);
    --jg-cell-selected: #e2cf9f;
    --jg-selected-edge: #9a742c;
    --jg-target-edge: rgba(154,116,44,0.35);
    --jg-target-dot: rgba(154,116,44,0.55);
    --jg-preview: #e3d0a1;
    --jg-coordinate: rgba(41,36,27,0.45);
    --jg-user: #8a651f;
    --jg-jiin: #2f6f7a;
    --jg-user-tint: rgba(154,116,44,0.12);
    --jg-jiin-tint: rgba(47,111,122,0.12);
    --jg-point-edge: rgba(154,116,44,0.45);
    --jg-connector: rgba(92,74,42,0.55);
    --jg-dot: #5c4a2a;
    --jg-message: rgba(41,36,27,0.78);
    --jg-event-edge: rgba(154,116,44,0.55);
    --jg-button-edge: rgba(41,36,27,0.16);
    --jg-button-bg: #fffdf8;
    --jg-button-ink: #29241b;
    --jg-button-hover-edge: rgba(154,116,44,0.6);
    --jg-button-hover-bg: rgba(154,116,44,0.08);
    --jg-primary: #9a742c;
    --jg-primary-hover: #876422;
    --jg-primary-ink: #fffdf8;
    --jg-focus: #9a742c;
    --jg-error-edge: rgba(178,59,44,0.35);
    --jg-error-bg: rgba(178,59,44,0.06);
    --jg-error-ink: #9b3326;
}
.jiin-game *, .jiin-game *::before, .jiin-game *::after { box-sizing: border-box; }
.jiin-game [hidden] { display: none !important; }
.jiin-game__header { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.jiin-game__title-group { min-width: 0; }
.jiin-game__eyebrow { color: var(--jg-accent); font-size: 10px; font-weight: 700; letter-spacing: .16em; }
.jiin-game h3.jiin-game__title { margin: 2px 0 0; color: var(--jg-ink); font-family: inherit; font-size: 19px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.jiin-game__status { flex: 0 0 auto; max-width: 45%; padding: 5px 9px; border: 1px solid var(--jg-pill-border); border-radius: 20px; background: var(--jg-pill-bg); font-size: 11px; line-height: 1.35; text-align: center; }
.jiin-game__status--user { background: var(--jg-turn-bg); border-color: var(--jg-turn-border); color: var(--jg-turn-ink); }
.jiin-game__legend { display: flex; justify-content: center; gap: 22px; margin: 17px 0 12px; color: var(--jg-muted); font-size: 12px; }
.jiin-game__player { display: inline-flex; align-items: center; gap: 7px; }
.jiin-game__player::before { content: ""; width: 9px; height: 9px; border-radius: 50%; }
.jiin-game__player--user::before { background: var(--jg-user); box-shadow: 0 0 0 2px var(--jg-user-tint); }
.jiin-game__player--jiin::before { background: var(--jg-jiin); box-shadow: 0 0 0 2px var(--jg-jiin-tint); }
.jiin-game__boards { display: grid; gap: 16px; min-width: 0; margin-top: 12px; }
.jiin-game__board-group { min-width: 0; margin: 0; }
.jiin-game h4.jiin-game__board-title { margin: 0 0 7px; color: var(--jg-heading); font-family: inherit; font-size: 13px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.jiin-game__board { display: grid; grid-template-columns: repeat(var(--jiin-game-columns, 3), minmax(0, 1fr)); gap: 5px; width: 100%; padding: 6px; border-radius: 12px; background: var(--jg-board); border: 1px solid var(--jg-board-edge); }
.jiin-game button { font-family: inherit; -webkit-tap-highlight-color: transparent; }
.jiin-game__cell {
    position: relative; display: grid; place-items: center; min-width: 0; width: 100%;
    aspect-ratio: 1; padding: 3px; border: 1px solid transparent; border-radius: 7px;
    background: var(--jg-cell); color: var(--jg-ink); cursor: pointer; touch-action: manipulation;
    transition: background .14s ease, border-color .14s ease, box-shadow .14s ease;
}
.jiin-game__cell--alternate { background: var(--jg-cell-alt); }
.jiin-game__cell--user { color: var(--jg-user); }
.jiin-game__cell--jiin { color: var(--jg-jiin); }
.jiin-game__cell:disabled { opacity: 1; cursor: default; }
.jiin-game__cell:not(:disabled):hover { background: var(--jg-cell-hover); border-color: var(--jg-cell-hover-edge); }
.jiin-game__cell--preview { background: var(--jg-preview); border-color: var(--jg-cell-hover-edge); }
.jiin-game__cell--selected { box-shadow: inset 0 0 0 2px var(--jg-selected-edge); background: var(--jg-cell-selected); }
.jiin-game__cell--target:not(:disabled) { border-color: var(--jg-target-edge); }
.jiin-game__cell--empty.jiin-game__cell--target::after { content: ""; position: absolute; width: 13%; height: 13%; border-radius: 50%; background: var(--jg-target-dot); }
.jiin-game__piece { font-size: clamp(23px, 7vw, 42px); font-weight: 650; line-height: 1; white-space: nowrap; max-width: 100%; overflow: hidden; }
.jiin-game__coordinate { position: absolute; top: 3px; left: 5px; color: var(--jg-coordinate); font-size: 9px; line-height: 1.2; font-weight: 400; }
.jiin-game__board--dense { gap: 2px; padding: 4px; border-radius: 9px; }
.jiin-game__board--dense .jiin-game__cell { border-radius: 3px; }
.jiin-game__board--dense .jiin-game__piece { font-size: clamp(17px, 4.6vw, 28px); }
.jiin-game__board--dense .jiin-game__coordinate { font-size: 7px; top: 1px; left: 2px; }
.jiin-game__board--wide .jiin-game__piece { font-size: clamp(12px, 3.6vw, 19px); }
.jiin-game__board--wide .jiin-game__cell { aspect-ratio: auto; min-height: 38px; padding: 12px 2px 4px; }
.jiin-game__board--diagram { gap: 0; padding: 10px; }
.jiin-game__board--diagram .jiin-game__cell { background: transparent; border-color: transparent; }
.jiin-game__board--diagram .jiin-game__cell--point { border-radius: 50%; background: var(--jg-cell-alt); border: 1px solid var(--jg-point-edge); }
.jiin-game__board--diagram .jiin-game__cell--point.jiin-game__cell--selected { background: var(--jg-cell-selected); }
.jiin-game__board--diagram .jiin-game__cell--target:not(:disabled) { border-color: var(--jg-cell-hover-edge); }
.jiin-game__cell--connector .jiin-game__piece,
.jiin-game__cell--edge .jiin-game__piece,
.jiin-game__cell--dot .jiin-game__piece { visibility: hidden; }
.jiin-game__cell--connector::after,
.jiin-game__cell--edge::after { content: ""; position: absolute; border-color: currentColor; border-style: solid; border-width: 0; border-radius: 0; }
.jiin-game__cell--horizontal::after { width: 100%; height: 0; top: 50%; left: 0; border-top-width: 2px; }
.jiin-game__cell--vertical::after { width: 0; height: 100%; left: 50%; top: 0; border-left-width: 2px; }
.jiin-game__cell--connector { color: var(--jg-connector); }
.jiin-game__board--dots { aspect-ratio: 1; padding: 16px; grid-template-columns: repeat(3, 10px minmax(0, 1fr)) 10px; grid-template-rows: repeat(3, 10px minmax(0, 1fr)) 10px; }
.jiin-game__board--dots .jiin-game__cell { aspect-ratio: auto; height: 100%; min-height: 0; padding: 0; }
.jiin-game__board--dots .jiin-game__cell--dot::after { content: ""; position: absolute; width: 7px; height: 7px; border-radius: 50%; background: var(--jg-dot); }
.jiin-game__board--dots .jiin-game__cell--edge { border: 0; }
.jiin-game__board--dots .jiin-game__cell--edge.jiin-game__cell--empty::after { background: none; border-radius: 0; border-color: var(--jg-target-dot); border-style: dashed; }
.jiin-game__board--dots .jiin-game__cell--edge.jiin-game__cell--horizontal::after { width: 100%; height: 0; border-width: 2px 0 0; }
.jiin-game__board--dots .jiin-game__cell--edge.jiin-game__cell--vertical::after { width: 0; height: 100%; border-width: 0 0 0 2px; }
.jiin-game__board--dots .jiin-game__cell--horizontal .jiin-game__coordinate { top: -8px; left: 45%; font-size: 8px; }
.jiin-game__board--dots .jiin-game__cell--vertical .jiin-game__coordinate { top: 45%; left: 9px; font-size: 8px; }
.jiin-game__board--dots .jiin-game__cell--box.jiin-game__cell--user { background: var(--jg-user-tint); }
.jiin-game__board--dots .jiin-game__cell--box.jiin-game__cell--jiin { background: var(--jg-jiin-tint); }
.jiin-game p.jiin-game__message { margin: 0; color: var(--jg-message); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.jiin-game p.jiin-game__event { margin: 12px 0 0; padding-left: 10px; border-left: 2px solid var(--jg-event-edge); color: var(--jg-muted); font-size: 12px; line-height: 1.5; overflow-wrap: anywhere; }
.jiin-game__controls { display: flex; flex-wrap: wrap; gap: 7px; padding-top: 14px; }
.jiin-game__button { appearance: none; min-height: 36px; margin: 0; padding: 7px 11px; border-radius: 9px; border: 1px solid var(--jg-button-edge); background: var(--jg-button-bg); color: var(--jg-button-ink); font-size: 12px; font-weight: 500; line-height: 1.4; cursor: pointer; touch-action: manipulation; }
.jiin-game__button:not(:disabled):hover { border-color: var(--jg-button-hover-edge); background: var(--jg-button-hover-bg); }
.jiin-game__button--primary { background: var(--jg-primary); border-color: var(--jg-primary); color: var(--jg-primary-ink); font-weight: 700; }
.jiin-game__button--primary:not(:disabled):hover { background: var(--jg-primary-hover); color: var(--jg-primary-ink); }
.jiin-game__button--quiet { margin-left: auto; border-color: transparent; background: transparent; color: var(--jg-muted); }
.jiin-game__button--armed, .jiin-game__button--armed:not(:disabled):hover { border-color: var(--jg-error-edge); background: var(--jg-error-bg); color: var(--jg-error-ink); }
.jiin-game__button:disabled { opacity: .45; cursor: default; }
.jiin-game button:focus-visible { outline: 2px solid var(--jg-focus); outline-offset: 2px; }
.jiin-game__choices { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; scroll-margin: 16px; }
.jiin-game p.jiin-game__choice-title { flex-basis: 100%; margin: 0 0 2px; font-size: 12px; line-height: 1.5; color: var(--jg-heading); }
.jiin-game__choice { white-space: normal; overflow-wrap: anywhere; text-align: left; }
.jiin-game__error { margin-top: 12px; padding: 10px; border: 1px solid var(--jg-error-edge); border-radius: 9px; background: var(--jg-error-bg); color: var(--jg-error-ink); font-size: 12px; overflow-wrap: anywhere; }
.jiin-game--busy .jiin-game__status { color: var(--jg-turn-ink); }
.jiin-game--closed .jiin-game__boards { opacity: .6; }
@media (max-width: 380px) {
    .jiin-game { padding: 11px; border-radius: 15px; }
    .jiin-game__header { gap: 6px; }
    .jiin-game__status { font-size: 10px; padding: 5px 7px; }
    .jiin-game__button { padding: 7px 9px; }
}
@media (prefers-reduced-motion: reduce) { .jiin-game__cell { transition: none; } }
