/* ── Müzayede — kadife müzayede salonu (koyu yeşil + altın) ── */
:root {
    --bg: #0f1d17;
    --panel: #15271f;
    --panel-2: #1d3429;
    --accent: #e3b341;
    --accent-2: #f3d27a;
    --text: #f4efe2;
    --muted: #9fb3a6;
    --error: #ff6b6b;
    --good: #6fdc8c;
    --radius: 16px;

    /* Oyuncu renkleri (c0..c7) */
    --pc0: #e3b341;
    --pc1: #6fdc8c;
    --pc2: #62b6cb;
    --pc3: #ff8fab;
    --pc4: #b388ff;
    --pc5: #ff9f68;
    --pc6: #4cc9f0;
    --pc7: #d4e157;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background:
        radial-gradient(900px 500px at 50% -10%, #1f3b2d 0%, transparent 60%),
        repeating-linear-gradient(135deg, rgba(227, 179, 65, 0.025) 0 2px, transparent 2px 14px),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
}

h1, h2, h3, .logo, .card-name, .round-label {
    font-family: Georgia, "Times New Roman", serif;
    letter-spacing: 0.3px;
}

/* ── Geri linki ─────────────────────────────────────── */
.back-link {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 50;
    color: var(--muted);
    text-decoration: none;
    background: rgba(21, 39, 31, 0.9);
    border: 1px solid rgba(227, 179, 65, 0.3);
    padding: 10px 16px;
    border-radius: 999px;
    font-size: 0.9rem;
    min-height: 40px;
    display: inline-flex;
    align-items: center;
    transition: color .2s, border-color .2s, transform .2s;
}
.back-link:hover { color: var(--text); border-color: var(--accent); transform: translateX(-2px); }

/* ── Ekranlar / paneller ────────────────────────────── */
.screen {
    width: 100%;
    max-width: 560px;
    padding: 72px 16px 32px;
    display: flex;
    flex-direction: column;
    align-items: center;
}
#screen-game { max-width: 720px; }

.panel {
    width: 100%;
    background: var(--panel);
    border: 1px solid rgba(227, 179, 65, 0.22);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.logo {
    font-size: 2.4rem;
    text-align: center;
    margin-bottom: 4px;
    font-weight: 700;
}
.logo-accent { color: var(--accent); font-style: italic; }
.tagline { text-align: center; color: var(--muted); margin-bottom: 22px; font-size: 0.95rem; }
.muted { color: var(--muted); font-weight: 400; }

.field-label {
    display: block;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin: 16px 0 6px;
}

input[type="text"], input[type="number"] {
    width: 100%;
    background: var(--panel-2);
    border: 1px solid rgba(227, 179, 65, 0.25);
    color: var(--text);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 1rem;
    outline: none;
    transition: border-color .2s;
}
input[type="text"]:focus, input[type="number"]:focus { border-color: var(--accent); }
#room-input { text-transform: uppercase; letter-spacing: 4px; }

/* ── Avatar ─────────────────────────────────────────── */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.avatar-btn {
    font-size: 1.5rem;
    background: var(--panel-2);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 8px 0;
    cursor: pointer;
    transition: transform .15s, border-color .15s;
}
.avatar-btn:hover { transform: scale(1.1); }
.avatar-btn.selected { border-color: var(--accent); box-shadow: 0 0 12px rgba(227, 179, 65, 0.45); }

/* ── Butonlar ───────────────────────────────────────── */
.btn {
    border: none;
    border-radius: 12px;
    padding: 12px 18px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform .15s, box-shadow .15s, background .15s;
    color: var(--text);
    min-height: 44px;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn-primary {
    background: linear-gradient(135deg, var(--accent), #c9962b);
    color: #1a1304;
    box-shadow: 0 8px 20px rgba(227, 179, 65, 0.3);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 12px 26px rgba(227, 179, 65, 0.4); }
.btn-ghost {
    background: transparent;
    border: 1px solid rgba(227, 179, 65, 0.35);
}
.btn-ghost:hover:not(:disabled) { background: rgba(227, 179, 65, 0.12); border-color: var(--accent); }
.btn-big { width: 100%; margin-top: 22px; font-size: 1.1rem; min-height: 52px; }

.entry-status { margin-top: 14px; text-align: center; color: var(--muted); font-size: 0.9rem; }

/* ── Lobi ───────────────────────────────────────────── */
.lobby-panel h2 { text-align: center; margin-bottom: 18px; }
.room-code-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 16px; }
.room-code-box {
    flex: 1;
    min-width: 120px;
    background: var(--panel-2);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
}
.room-code-box .muted { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 1px; }
.room-code-box strong { font-size: 1.6rem; letter-spacing: 6px; color: var(--accent); font-family: Georgia, serif; }

.players-title { margin: 8px 0 10px; font-size: 1rem; }
.player-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.player-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--panel-2);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 14px;
}
.player-item.me { border-color: rgba(227, 179, 65, 0.5); }
.player-avatar { font-size: 1.4rem; }
.player-name { flex: 1; font-weight: 600; }
.host-badge { font-size: 1.1rem; }
.host-note { text-align: center; margin-top: 18px; }

.rounds-control { display: flex; align-items: center; gap: 14px; }
.rounds-control input[type="range"] { flex: 1; accent-color: var(--accent); }
.rounds-control strong { font-size: 1.4rem; color: var(--accent); min-width: 2ch; text-align: center; }

.rules {
    margin-top: 18px;
    background: var(--panel-2);
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.88rem;
    color: var(--muted);
}
.rules strong { color: var(--text); display: block; margin-bottom: 6px; }
.rules ul { padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

/* ── Oyun ekranı ────────────────────────────────────── */
.game-wrap { width: 100%; display: flex; flex-direction: column; gap: 14px; }

.scoreboard { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.score-chip {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--panel);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.85rem;
    transition: border-color .2s, box-shadow .2s;
}
.chip-avatar { font-size: 1.05rem; }
.chip-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.chip-coins { color: var(--muted); }
.chip-score { font-size: 0.95rem; }
.score-chip.bid-done { border-color: rgba(111, 220, 140, 0.5); }
.score-chip.winner { border-color: var(--accent); box-shadow: 0 0 14px rgba(227, 179, 65, 0.5); }
.score-chip.doubled::after { content: "✨"; }
.score-chip.c0 .chip-score { color: var(--pc0); }
.score-chip.c1 .chip-score { color: var(--pc1); }
.score-chip.c2 .chip-score { color: var(--pc2); }
.score-chip.c3 .chip-score { color: var(--pc3); }
.score-chip.c4 .chip-score { color: var(--pc4); }
.score-chip.c5 .chip-score { color: var(--pc5); }
.score-chip.c6 .chip-score { color: var(--pc6); }
.score-chip.c7 .chip-score { color: var(--pc7); }

.round-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--panel);
    border: 1px solid rgba(227, 179, 65, 0.22);
    border-radius: 12px;
    padding: 8px 14px;
}
.round-label { font-size: 1.05rem; color: var(--accent); }
.phase-label { color: var(--muted); font-size: 0.9rem; }
.timer {
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 1.2rem;
    min-width: 2.6ch;
    text-align: center;
    background: var(--panel-2);
    border-radius: 8px;
    padding: 2px 8px;
}
.timer.urgent { color: var(--error); animation: pulse .6s infinite alternate; }
@keyframes pulse { from { transform: scale(1); } to { transform: scale(1.12); } }

/* ── Kart ───────────────────────────────────────────── */
.stage { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 6px 0; }
.auction-card {
    width: min(220px, 58vw);
    aspect-ratio: 5 / 7;
    perspective: 1000px;
}
.card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform .7s cubic-bezier(.4, .1, .2, 1);
}
.auction-card.flipped .card-inner { transform: rotateY(180deg); }
.auction-card.wobble .card-inner { animation: wobble 2.4s ease-in-out infinite; }
@keyframes wobble {
    0%, 100% { transform: rotate(-2deg) translateY(0); }
    50% { transform: rotate(2deg) translateY(-6px); }
}
.card-back, .card-face {
    position: absolute;
    inset: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 16px;
    text-align: center;
}
.card-back {
    background:
        repeating-linear-gradient(45deg, rgba(227, 179, 65, 0.08) 0 6px, transparent 6px 12px),
        linear-gradient(160deg, #1f3a2c, #10221a);
    border: 2px solid var(--accent);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55), inset 0 0 0 6px rgba(227, 179, 65, 0.12);
}
.card-seal { font-size: 2.6rem; color: var(--accent); }
.card-hint { font-size: 1.1rem; font-weight: 700; color: var(--accent-2); font-family: Georgia, serif; }
.card-sub { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.card-face {
    transform: rotateY(180deg);
    background: linear-gradient(160deg, #f6e7c1, #e3c47a);
    color: #2a1f08;
    border: 2px solid #b48a2a;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.55);
}
.card-icon { font-size: 3rem; }
.card-name { font-size: 1.15rem; font-weight: 700; }
.card-value { font-size: 1.8rem; font-weight: 800; }
.auction-card.is-bad .card-face { background: linear-gradient(160deg, #cfc8bb, #a39b8c); color: #2a2a2a; border-color: #777; }
.auction-card.is-good .card-face { box-shadow: 0 0 30px rgba(227, 179, 65, 0.6); }

.double-note { font-size: 0.9rem; color: var(--accent-2); text-align: center; }

/* ── Faz panelleri ──────────────────────────────────── */
.phase-panel { padding: 18px 20px; }
.bid-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.bid-head strong { color: var(--accent); font-size: 1.1rem; }
.bid-row { display: flex; gap: 12px; align-items: center; }
.bid-row input[type="range"] { flex: 1; accent-color: var(--accent); min-height: 32px; }
.bid-row input[type="number"] { width: 92px; text-align: center; font-size: 1.15rem; font-weight: 700; }
.bid-actions { display: flex; gap: 10px; margin-top: 14px; }
.bid-actions .btn { flex: 1; }
.bid-status { text-align: center; margin-top: 10px; font-size: 0.88rem; }

.target-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn-target { flex: 1 1 140px; background: var(--panel-2); border: 1px solid rgba(255, 255, 255, 0.12); }
.btn-target:hover:not(:disabled) { border-color: var(--error); background: rgba(255, 107, 107, 0.12); }
#target-panel h3 { margin-bottom: 4px; }

.effect-text { font-size: 1rem; line-height: 1.45; margin-bottom: 12px; color: var(--accent-2); }
.bids-title { font-size: 0.85rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); margin-bottom: 8px; }
.bid-list { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.bid-item {
    display: flex;
    justify-content: space-between;
    background: var(--panel-2);
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 8px 12px;
    font-size: 0.92rem;
}
.bid-item.winner { border-color: var(--accent); box-shadow: 0 0 10px rgba(227, 179, 65, 0.35); }
.bid-item.c0 strong { color: var(--pc0); }
.bid-item.c1 strong { color: var(--pc1); }
.bid-item.c2 strong { color: var(--pc2); }
.bid-item.c3 strong { color: var(--pc3); }
.bid-item.c4 strong { color: var(--pc4); }
.bid-item.c5 strong { color: var(--pc5); }
.bid-item.c6 strong { color: var(--pc6); }
.bid-item.c7 strong { color: var(--pc7); }
#next-btn { width: 100%; margin-top: 12px; }

/* ── Oyun sonu ──────────────────────────────────────── */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 16, 12, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 40;
}
.overlay-panel { max-width: 460px; text-align: center; }
.gameover-emoji { font-size: 3.2rem; margin-bottom: 8px; }
#gameover-title { margin-bottom: 6px; }
.gameover-scores { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
.series-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--panel-2);
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 10px 14px;
}
.series-chip .rank { color: var(--muted); min-width: 2ch; }
.series-chip .who { flex: 1; text-align: left; font-weight: 600; }
.series-chip strong { font-size: 1.1rem; }
.series-chip.winner { border-color: var(--accent); box-shadow: 0 0 12px rgba(227, 179, 65, 0.4); }
.series-chip.c0 strong { color: var(--pc0); }
.series-chip.c1 strong { color: var(--pc1); }
.series-chip.c2 strong { color: var(--pc2); }
.series-chip.c3 strong { color: var(--pc3); }
.series-chip.c4 strong { color: var(--pc4); }
.series-chip.c5 strong { color: var(--pc5); }
.series-chip.c6 strong { color: var(--pc6); }
.series-chip.c7 strong { color: var(--pc7); }

/* ── Toast ──────────────────────────────────────────── */
.toasts {
    position: fixed;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 60;
    width: min(92vw, 420px);
}
.toast {
    background: var(--panel-2);
    border-left: 4px solid var(--accent);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.92rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: opacity .3s, transform .3s;
}
.toast-error { border-left-color: var(--error); }
.toast-success { border-left-color: var(--good); }
.toast-out { opacity: 0; transform: translateY(10px); }

/* ── Mobil ──────────────────────────────────────────── */
@media (max-width: 560px) {
    .screen { padding: 64px 12px 24px; }
    .panel { padding: 20px 16px; }
    .avatar-grid { grid-template-columns: repeat(4, 1fr); }
    .chip-name { max-width: 70px; }
    .round-bar { flex-wrap: wrap; }
    .bid-row input[type="number"] { width: 76px; }
}

@media (prefers-reduced-motion: reduce) {
    .auction-card.wobble .card-inner { animation: none; }
    .card-inner { transition: none; }
    .timer.urgent { animation: none; }
}
