/* ── Çizgi Telefon — defter / karakalem teması ──────── */
:root {
    --paper: #f6f1e4;
    --paper-2: #fffdf7;
    --line: #d9d0bc;
    --ink: #1f2430;
    --muted: #6f7686;
    --pen: #1f4fd8;
    --pen-soft: rgba(31, 79, 216, 0.14);
    --accent: #e8542f;
    --error: #d7263d;
    --radius: 14px;
    --shadow: 0 10px 30px rgba(50, 40, 20, 0.14);
}

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

/* hidden attribute'u .screen/.overlay display kurallarına yenilmesin */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    color: var(--ink);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-color: var(--paper);
    background-image:
        radial-gradient(circle at 15% 10%, rgba(255, 255, 255, 0.7), transparent 45%),
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(31, 79, 216, 0.09) 31px 32px);
    background-attachment: fixed;
}

/* ── Geri linki ─────────────────────────────────────── */
.back-link {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 50;
    color: var(--muted);
    text-decoration: none;
    background: rgba(255, 253, 247, 0.9);
    border: 1px solid var(--line);
    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(--pen); border-color: var(--pen); 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: 680px; }

.panel {
    width: 100%;
    background: var(--paper-2);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px 24px;
    box-shadow: var(--shadow);
    position: relative;
}
.panel::before {
    /* defter kenar deliği hissi */
    content: "";
    position: absolute;
    left: 14px;
    top: 16px;
    bottom: 16px;
    width: 1px;
    background: rgba(232, 84, 47, 0.35);
    pointer-events: none;
}

.logo {
    text-align: center;
    font-size: 2.3rem;
    letter-spacing: -0.5px;
    margin-bottom: 4px;
    font-weight: 800;
}
.logo-accent {
    color: var(--pen);
    text-decoration: underline wavy rgba(31, 79, 216, 0.5);
    text-underline-offset: 6px;
}
.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.82rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--muted);
    margin: 14px 0 6px;
}

input[type="text"], textarea {
    width: 100%;
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    transition: border-color .2s, box-shadow .2s;
}
input[type="text"]:focus, textarea:focus {
    border-color: var(--pen);
    box-shadow: 0 0 0 3px var(--pen-soft);
}
#room-input { text-transform: uppercase; letter-spacing: 4px; }
textarea { resize: vertical; min-height: 70px; line-height: 1.4; }

/* Avatar */
.avatar-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
}
.avatar-btn {
    font-size: 1.5rem;
    background: #fff;
    border: 2px solid var(--line);
    border-radius: 10px;
    padding: 8px 0;
    cursor: pointer;
    transition: transform .15s, border-color .15s, background .15s;
}
.avatar-btn:hover { transform: scale(1.1); background: var(--paper); }
.avatar-btn.selected {
    border-color: var(--pen);
    background: var(--pen-soft);
}

/* Butonlar */
.btn {
    border: none;
    border-radius: 10px;
    padding: 12px 18px;
    font-size: 0.98rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: transform .15s, box-shadow .15s, background .15s, opacity .15s;
    min-height: 44px;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none !important; }
.btn-primary {
    background: var(--pen);
    color: #fff;
    box-shadow: 0 6px 16px rgba(31, 79, 216, 0.3);
}
.btn-primary:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 8px 20px rgba(31, 79, 216, 0.4); }
.btn-ghost {
    background: #fff;
    color: var(--ink);
    border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--pen); color: var(--pen); }
.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;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.room-code-box {
    flex: 1;
    background: #fff;
    border: 1px dashed var(--pen);
    border-radius: 10px;
    padding: 8px 14px;
    display: flex;
    flex-direction: column;
    min-width: 120px;
}
.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(--pen); }

.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: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 9px 12px;
}
.player-item.me { border-color: var(--accent); }
.player-avatar { font-size: 1.4rem; }
.player-name { flex: 1; font-weight: 600; }
.host-badge { font-size: 1.1rem; }

.rules-box {
    margin-top: 18px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 12px 14px 12px 32px;
    font-size: 0.92rem;
    color: var(--muted);
}
.rules-box strong { color: var(--ink); display: block; margin-left: -18px; margin-bottom: 6px; }
.rules-box li { margin: 3px 0; }

.host-note { text-align: center; margin-top: 18px; }

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

.phase-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    background: var(--ink);
    color: #fff;
    border-radius: 12px;
    padding: 10px 16px;
    box-shadow: var(--shadow);
}
.phase-left, .phase-right { display: flex; align-items: center; gap: 12px; }
.phase-bar .muted { color: rgba(255, 255, 255, 0.65); font-size: 0.85rem; }
.phase-kind { font-weight: 700; }
.timer {
    font-variant-numeric: tabular-nums;
    font-weight: 800;
    font-size: 1.15rem;
    background: var(--pen);
    padding: 4px 12px;
    border-radius: 999px;
    min-width: 54px;
    text-align: center;
}
.timer.urgent { background: var(--accent); animation: pulse 0.8s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

.step-panel h2 { margin-bottom: 6px; }
.row-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-top: 12px;
    flex-wrap: wrap;
}
#write-count { font-size: 0.85rem; }

.prompt-image-wrap {
    margin: 12px 0;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 8px;
}
.prompt-image-wrap img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 6px;
    image-rendering: auto;
}

.draw-label { margin-bottom: 2px; font-size: 0.82rem; text-transform: uppercase; letter-spacing: 1px; }
.draw-title {
    font-size: 1.25rem;
    line-height: 1.3;
    margin-bottom: 12px;
    padding: 10px 14px;
    background: var(--pen-soft);
    border-left: 4px solid var(--pen);
    border-radius: 8px;
}

.toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.color-row { display: flex; gap: 8px; flex-wrap: wrap; }
.color-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 3px solid #fff;
    box-shadow: 0 0 0 1px var(--line);
    cursor: pointer;
    transition: transform .15s;
}
.color-btn:hover { transform: scale(1.1); }
.color-btn.selected { box-shadow: 0 0 0 3px var(--ink); }

.tool-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.size-row { display: flex; gap: 6px; }
.size-btn {
    width: 38px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.size-btn .dot { background: var(--ink); border-radius: 50%; display: block; }
.size-btn.selected { border-color: var(--pen); background: var(--pen-soft); }
.tool-btn {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    padding: 0 12px;
    height: 36px;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink);
}
.tool-btn:hover { border-color: var(--pen); color: var(--pen); }
.tool-btn.active { background: var(--ink); color: #fff; border-color: var(--ink); }

.canvas-frame {
    width: 100%;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 6px;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.02);
}
#draw-canvas {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    background: #fff;
    border-radius: 6px;
    touch-action: none;
    cursor: crosshair;
}

/* Bekleme */
.wait-panel { text-align: center; }
.wait-emoji { font-size: 2.6rem; margin-bottom: 6px; }
.wait-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
    margin-top: 14px;
}
.wait-list li {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 6px 12px;
    font-size: 0.9rem;
    color: var(--muted);
}
.wait-list li.done { border-color: var(--pen); color: var(--pen); font-weight: 600; }

/* Reveal */
.reveal-panel h2 { margin-bottom: 14px; }
.reveal-cards { display: flex; flex-direction: column; gap: 12px; }
.reveal-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 14px;
    animation: cardIn .35s ease-out;
}
@keyframes cardIn {
    from { opacity: 0; transform: translateY(10px) rotate(-0.5deg); }
    to { opacity: 1; transform: none; }
}
.reveal-card .author {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--muted);
    margin-bottom: 8px;
}
.reveal-card .author .av { font-size: 1.2rem; }
.reveal-card .author .what { margin-left: auto; font-weight: 600; }
.reveal-card.text .content {
    font-size: 1.15rem;
    font-weight: 600;
    line-height: 1.35;
}
.reveal-card.text .content.empty { color: var(--muted); font-style: italic; font-weight: 400; }
.reveal-card.image img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--line);
}
.reveal-card.image .empty-draw {
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-style: italic;
    background: var(--paper);
    border-radius: 8px;
}
.reveal-card.text.last, .reveal-card.image.last { border-color: var(--pen); box-shadow: 0 0 0 3px var(--pen-soft); }

/* Overlay */
.overlay {
    position: fixed;
    inset: 0;
    background: rgba(40, 32, 18, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 40;
}
.overlay-panel { max-width: 420px; text-align: center; }
.gameover-emoji { font-size: 3.2rem; margin-bottom: 8px; }
.overlay-panel .btn-ghost { margin-top: 16px; width: 100%; }

/* Toast */
.toasts {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 100;
    width: min(92vw, 420px);
}
.toast {
    background: var(--ink);
    color: #fff;
    padding: 12px 16px;
    border-radius: 10px;
    border-left: 4px solid var(--pen);
    font-size: 0.92rem;
    box-shadow: var(--shadow);
}
.toast-error { border-left-color: var(--error); }
.toast-success { border-left-color: #2ab36b; }
.toast-out { opacity: 0; transform: translateY(10px); transition: opacity .3s, transform .3s; }

@media (max-width: 560px) {
    .screen { padding: 64px 12px 24px; }
    .panel { padding: 22px 16px 22px 20px; }
    .panel::before { left: 9px; }
    .phase-bar { padding: 8px 12px; flex-wrap: wrap; }
    .avatar-grid { grid-template-columns: repeat(4, 1fr); }
    .tool-btn { padding: 0 9px; font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
