/* =========================================================
   Helpalot Chess – Styles
   Simple, clean design. Mobile-first.
   ========================================================= */

/* ── Reset / root ──────────────────────────────────────── */

/* Bungee Regular font */
@font-face {
    font-family: 'Bungee';
    src: url('../fonts/Bungee-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

.helpalot-chess-root {
    box-sizing: border-box;
    font-family: 'Georgia', serif;
    color: #1a1a1a;
    max-width: 520px;
    margin: 0 auto;
    padding: 16px;
}

.helpalot-chess-root *,
.helpalot-chess-root *::before,
.helpalot-chess-root *::after {
    box-sizing: inherit;
}

/* ── Select screen ─────────────────────────────────────── */
.hc-select {
    text-align: center;
    padding: 32px 16px 40px;
    background: #a89676;
    border-radius: 8px;
}

.hc-title {
    font-family: 'Bungee', 'Georgia', serif;
    font-size: clamp(2rem, 7vw, 3rem);
    margin: 0 0 4px;
    margin-bottom: 1rem;
    color: #f8ead8;
}

.hc-tagline {
    color: #888;
    margin: 0 0 28px;
    font-style: italic;
    font-size: 0.95rem;
}

.hc-subtitle {
    color: #666;
    margin: 0 0 40px;
    font-style: italic;
}

.hc-rules-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 600px;
    margin: 0 auto 16px;
    color: #f8ead8;
}

.hc-rule-icons {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 4px;
}

.hc-rule-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
}

.hc-rule-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
}

.hc-rule-text {
    display: block;
}

.hc-rule-footer {
    text-align: center;
    color: #333;
    max-width: 600px;
    margin: 0 auto 24px;
}

.hc-select-buttons {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ── Buttons ───────────────────────────────────────────── */
.hc-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 12px 24px;
    border: 2px solid #1a1a1a;
    border-radius: 6px;
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    background: #fff;
    color: #1a1a1a;
    white-space: nowrap;
    padding: 0.7rem !important;
}

.hc-btn-primary {
    background: #1a1a1a;
    color: #fff;
}

.hc-btn-primary:hover { background: #333; }

.hc-btn-secondary {
    background: #fff;
    color: #1a1a1a;
}

.hc-btn-secondary:hover { background: #f5f5f5; }

.hc-btn-sm {
    padding: 6px 12px;
    font-size: 0.82rem;
}

.hc-btn-promote {
    background: #f0a830;
    border-color: #c88010;
    color: #1a1a1a;
}

.hc-btn-promote:hover { background: #e09820; }

.hc-btn-icon {
    font-size: 1.3em;
}

.hc-mode-toggle {
    background: #f0a830;
    border-color: #c88010;
    color: #1a1a1a;
}

/* ── Game screen layout ────────────────────────────────── */
.hc-game {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ── Header bar (3 columns) ────────────────────────────── */
.hc-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 6px;
    background: #f8f6f2;
    border: 1px solid #e0dbd0;
    border-radius: 8px;
    padding: 8px 10px;
    min-height: 48px;
}

.hc-header-left {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hc-header-mid {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}

.hc-header-right {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

/* Turn indicator */
.hc-turn-indicator {
    display: flex;
    align-items: center;
    gap: 5px;
    font-weight: bold;
    font-size: 0.9rem;
}

.hc-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid #1a1a1a;
    display: inline-block;
    flex-shrink: 0;
}

.hc-dot-white { background: #f5f0e8; }
.hc-dot-black { background: #2c1a0e; }

/* Check declared badges */
.hc-check-badge {
    font-size: 0.7rem;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    border: 1px solid currentColor;
    white-space: nowrap;
}

.hc-check-white {
    background: #fff8e8;
    color: #b07000;
    border-color: #e0b040;
}

.hc-check-black {
    background: #3a2a1a;
    color: #f0c060;
    border-color: #c09030;
}

/* Dice */
.hc-dice {
    font-size: 2.8rem;
    line-height: 1;
}

.hc-dice-face {
    display: inline-block;
    animation: hc-pop 0.2s ease-out;
}

@keyframes hc-pop {
    0%   { transform: scale(0.6); opacity: 0; }
    60%  { transform: scale(1.25); }
    100% { transform: scale(1);   opacity: 1; }
}

/* Win */
.hc-win-text {
    font-weight: bold;
    font-size: 0.9rem;
    color: #1a1a1a;
}

/* Thinking */
.hc-thinking {
    font-style: italic;
    color: #888;
    font-size: 0.85rem;
    white-space: nowrap;
}

/* Promotion label */
.hc-promote-label {
    font-size: 0.85rem;
    color: #555;
}

/* ── Status line ───────────────────────────────────────── */
.hc-status {
    background: #f8f6f2;
    border: 1px solid #e0dbd0;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 0.85rem;
    text-align: center;
    color: #555;
    min-height: 30px;
}

/* ── Board ─────────────────────────────────────────────── */
.hc-board-wrap {
    width: 100%;
}

.hc-board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows:    repeat(8, 1fr);
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 2px solid #1a1a1a;
    border-radius: 4px;
    overflow: hidden;
}

.hc-square {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: filter 0.1s;
}

.hc-square:hover {
    filter: brightness(0.91);
}

.hc-light { background: var(--hc-light-square, #f0d9b5); }
.hc-dark  { background: var(--hc-dark-square,  #b58863); }

/* Last-moved square: slightly darker */
.hc-last-move.hc-light { background: var(--hc-light-last, #cdb97a); }
.hc-last-move.hc-dark  { background: var(--hc-dark-last,  #8a6340); }

/* Selection & highlights */
.hc-selected {
    outline: 3px solid #3a7bd5;
    outline-offset: -3px;
    z-index: 2;
}

.hc-valid::after {
    content: '';
    position: absolute;
    width: 32%;
    height: 32%;
    border-radius: 50%;
    background: rgba(0, 120, 255, 0.45);
    pointer-events: none;
}

.hc-capture::after {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 2px;
    border: 3px solid rgba(200, 40, 40, 0.7);
    pointer-events: none;
}

.hc-promotable {
    outline: 3px solid #f0a830;
    outline-offset: -3px;
}

/* ── Pieces ─────────────────────────────────────────────── */

/* Classic mode */
.hc-piece {
    width: 82%;
    height: 82%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    filter: drop-shadow(0 1px 2px rgba(0,0,0,0.4));
}

.hc-piece svg {
    width: 100%;
    height: 100%;
}

.hc-piece.hc-white .piece-body {
    fill:   #f5f0e8;
    stroke: #2c1a0e;
}
.hc-piece.hc-white .piece-eye {
    fill:   #2c1a0e;
    stroke: none;
}
.hc-piece.hc-black .piece-body {
    fill:   #2c1a0e;
    stroke: #f5f0e8;
}
.hc-piece.hc-black .piece-eye {
    fill:   #f5f0e8;
    stroke: none;
}

/* Creature mode — SVG only, absolutely positioned so it never stretches the square */
.hc-piece-creature {
    position: absolute;
    width: 88%;
    height: 88%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.hc-piece-creature svg {
    width: 100%;
    height: 100%;
}

.hc-piece-creature.hc-white .piece-body {
    fill:   var(--hc-white-piece, #1a3a6b);
    stroke: var(--hc-white-piece, #1a3a6b);
}
.hc-piece-creature.hc-black .piece-body {
    fill:   var(--hc-black-piece, #c0392b);
    stroke: var(--hc-black-piece, #c0392b);
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 420px) {
    .helpalot-chess-root { padding: 8px; }
    .hc-header { padding: 6px 8px; gap: 4px; }
    .hc-btn-sm { padding: 5px 8px; font-size: 0.75rem; }
    .hc-status  { font-size: 0.78rem; }
    .hc-turn-indicator { font-size: 0.8rem; }
}
