@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&family=Space+Grotesk:wght@400;500;700&display=swap");

:root {
    --ink: #121a33;
    --ink-soft: #425072;
    --bg-deep: #071236;
    --bg-mid: #1f3f95;
    --bg-light: #d9e5ff;
    --panel: #f8fbff;
    --line: #b8c8ef;
    --gold: #ffbe0b;
    --orange: #fb5607;
    --green: #18984e;
    --red: #d7273f;
    --blue-chip: #313ea3;
    --shadow: 0 20px 35px rgba(6, 16, 45, 0.25);
}

* {
    box-sizing: border-box;
}

html,
body {
    height: 100%;
}

body {
    margin: 0;
    font-family: "Space Grotesk", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at 10% 10%, rgba(255, 190, 11, 0.25), transparent 35%),
        radial-gradient(circle at 88% 20%, rgba(251, 86, 7, 0.2), transparent 34%),
        linear-gradient(130deg, var(--bg-deep), var(--bg-mid));
    background-attachment: fixed;
}

.bg-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 32px 32px;
    opacity: 0.35;
    z-index: -1;
}

.top-header {
    width: min(1180px, calc(100% - 2rem));
    margin: 1.3rem auto 0;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(245, 249, 255, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: var(--shadow);
}

.brand {
    color: var(--ink);
    text-decoration: none;
    font-family: "Archivo Black", sans-serif;
    letter-spacing: 0.03em;
    font-size: 1.1rem;
}

.top-nav {
    display: flex;
    gap: 0.8rem;
}

.top-nav a {
    text-decoration: none;
    color: var(--ink);
    font-weight: 700;
    padding: 0.45rem 0.8rem;
    border-radius: 10px;
    transition: 0.2s ease;
}

.top-nav a:hover {
    background: #e5edff;
}

.page-shell {
    width: min(1180px, calc(100% - 2rem));
    margin: 1rem auto 2rem;
}

.flash-stack {
    display: grid;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.flash {
    border-radius: 12px;
    padding: 0.8rem 1rem;
    font-weight: 600;
}

.flash-success {
    background: #def6e7;
    border: 1px solid #8cd6a7;
}

.flash-error {
    background: #ffe5ea;
    border: 1px solid #f3a0ae;
}

.hero {
    color: #ffffff;
    padding: clamp(1.3rem, 4vw, 3rem);
    border-radius: 24px;
    background: linear-gradient(140deg, rgba(3, 28, 89, 0.86), rgba(37, 74, 181, 0.86));
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: var(--shadow);
}

.eyebrow {
    margin: 0;
    text-transform: uppercase;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    opacity: 0.9;
}

.hero h1 {
    margin: 0.5rem 0 0.6rem;
    font-family: "Archivo Black", sans-serif;
    font-size: clamp(1.8rem, 5vw, 2.8rem);
    line-height: 1.1;
}

.hero p {
    margin: 0;
    max-width: 54ch;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.2rem;
}

.card-grid {
    margin-top: 1rem;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.9rem;
}

.feature-card {
    border-radius: 18px;
    background: var(--panel);
    border: 1px solid var(--line);
    padding: 1rem;
    box-shadow: var(--shadow);
}

.feature-card h2 {
    margin: 0 0 0.45rem;
    font-size: 1.15rem;
}

.feature-card p {
    margin: 0;
    color: var(--ink-soft);
}

.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1.2rem;
    box-shadow: var(--shadow);
}

.panel h1,
.panel h2,
.panel h3 {
    margin-top: 0;
}

.narrow {
    width: min(620px, 100%);
    margin: 0 auto;
}

.subtle {
    margin-top: 0;
    color: var(--ink-soft);
}

.stack-form {
    display: grid;
    gap: 0.55rem;
}

label {
    font-weight: 700;
    font-size: 0.95rem;
}

input,
textarea,
button {
    font: inherit;
}

input,
textarea {
    width: 100%;
    border: 1px solid #8fa5de;
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
    background: #ffffff;
    color: var(--ink);
}

textarea {
    resize: vertical;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 0.62rem 0.95rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    justify-content: center;
    align-items: center;
}

.btn-primary {
    background: linear-gradient(130deg, var(--orange), #ff7f33);
    color: #fff;
}

.btn-secondary {
    background: linear-gradient(130deg, #1f3694, #304ec7);
    color: #fff;
}

.btn-ghost {
    background: #edf3ff;
    border: 1px solid #bcccf5;
    color: var(--ink);
}

.panel-header-row {
    display: flex;
    gap: 0.7rem;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.link-chip {
    text-decoration: none;
    color: #fff;
    background: #233fb5;
    border-radius: 999px;
    padding: 0.4rem 0.8rem;
    font-weight: 700;
}

.editor-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
}

.editor-toolbar label {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.editor-toolbar input[type="number"] {
    width: 72px;
}

.editor-grid {
    overflow-x: auto;
}

/* --- Yeni sütun-tabanlı editor ızgarası --- */
.editor-col-grid {
    display: grid;
    grid-template-columns: repeat(var(--col-count, 5), minmax(210px, 1fr));
    gap: 0.55rem;
    min-width: 0;
}

.editor-col-header {
    background: #e8eeff;
    border: 1px solid #c5d3f5;
    border-radius: 10px;
    padding: 0.45rem;
}

.editor-col-header input {
    width: 100%;
    font-weight: 700;
    background: transparent;
    border: none;
    padding: 0;
    border-bottom: 2px solid #8fa5de;
    border-radius: 0;
}

.editor-col-body {
    display: grid;
    gap: 0.45rem;
    align-content: start;
}

.editor-clue-cell {
    background: #f4f7ff;
    border: 1px solid #d2ddfb;
    border-radius: 12px;
    padding: 0.55rem;
    display: grid;
    gap: 0.45rem;
}

.editor-clue-cell label {
    display: grid;
    gap: 0.3rem;
    font-size: 0.82rem;
    font-weight: 700;
}

.editor-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.7rem;
    margin-top: 1rem;
}

.link-card {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 0.95rem;
    padding: 0.8rem;
    border-radius: 14px;
    border: 1px solid #c9d8fb;
    background: #f3f7ff;
}

.copy-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
}

.play-panel {
    padding: 0.9rem;
}

.play-layout {
    display: grid;
    grid-template-columns: minmax(260px, 300px) 1fr;
    gap: 0.9rem;
}

/* ===== Tam-ekran oyun modu ===== */
body.play-mode {
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

body.play-mode .top-header {
    width: calc(100% - 1rem);
    margin: 0.4rem auto;
    padding: 0.45rem 0.9rem;
    border-radius: 12px;
    flex-shrink: 0;
}

body.play-mode .page-shell {
    flex: 1;
    min-height: 0;
    width: calc(100% - 1rem);
    margin: 0 auto 0.4rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.play-mode .play-panel {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding: 0.6rem;
    overflow: hidden;
}

body.play-mode .play-layout {
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

body.play-mode .team-column {
    overflow-y: auto;
}

body.play-mode .board-column {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

body.play-mode .board-grid {
    flex: 1;
    min-height: 0;
    grid-auto-rows: 1fr;
    align-items: stretch;
}

body.play-mode .board-header {
    min-height: unset;
    height: 100%;
}

body.play-mode .clue-btn {
    min-height: unset;
    height: 100%;
    width: 100%;
}

.team-column {
    background: #e9f1ff;
    border: 1px solid #c7d8ff;
    border-radius: 16px;
    padding: 0.8rem;
    display: grid;
    align-content: start;
    gap: 0.8rem;
}

.team-column h2 {
    margin: 0;
}

.team-config {
    display: grid;
    gap: 0.4rem;
}

.team-config-controls {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem;
}

.active-points {
    font-weight: 700;
    color: #1c2f77;
    background: #dbe6ff;
    border: 1px dashed #7e9be9;
    border-radius: 10px;
    padding: 0.55rem 0.7rem;
}

.teams-container {
    display: grid;
    gap: 0.6rem;
}

.team-card {
    background: #ffffff;
    border: 1px solid #d4def8;
    border-radius: 12px;
    padding: 0.45rem;
    display: grid;
    gap: 0.42rem;
    transition: box-shadow 0.25s, border-color 0.25s;
}

.team-card--active {
    border-color: #ffbe0b;
    box-shadow: 0 0 0 3px rgba(255, 190, 11, 0.45), 0 4px 18px rgba(255, 190, 11, 0.25);
    background: #fffbec;
}

.team-card--active .team-score {
    background: #e6a800;
}

.team-name-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.team-name-row .team-name-input {
    flex: 1;
    min-width: 0;
}

.turn-badge {
    white-space: nowrap;
    font-size: 0.7rem;
    font-weight: 700;
    color: #b07d00;
    background: #fff0b3;
    border: 1px solid #e6c000;
    border-radius: 999px;
    padding: 0.15rem 0.45rem;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.2s, transform 0.2s;
    pointer-events: none;
}

.turn-badge--visible {
    opacity: 1;
    transform: scale(1);
}

.btn-give-turn {
    width: 100%;
    font-size: 0.78rem;
    padding: 0.3rem 0.5rem;
    background: #edf3ff;
    border: 1px solid #b8ccf5;
    border-radius: 8px;
    color: var(--ink);
    cursor: pointer;
    font-weight: 600;
    transition: background 0.15s;
}

.btn-give-turn:hover:not(:disabled) {
    background: #d8e7ff;
}

.btn-give-turn:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.team-name-input {
    border-radius: 0;
    border: 0;
    border-bottom: 3px solid #1b1b1b;
    font-size: 1.05rem;
    font-weight: 700;
    padding: 0.3rem 0.2rem;
}

.team-score {
    background: var(--blue-chip);
    color: #fff;
    border-radius: 2px;
    text-align: center;
    font-family: "Archivo Black", sans-serif;
    font-size: 2rem;
    line-height: 1;
    padding: 0.5rem 0.3rem;
}

.team-score-controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.45rem;
}

.team-score-controls button {
    border: 0;
    background: transparent;
    font-size: 2rem;
    line-height: 1;
    font-weight: 700;
    cursor: pointer;
}

.team-score-controls .plus-btn {
    color: var(--green);
}

.team-score-controls .minus-btn {
    color: var(--red);
}

.board-column {
    background: #152968;
    border-radius: 16px;
    padding: 0.75rem;
    border: 1px solid #425fca;
}

.board-grid {
    --col-count: 5;
    display: grid;
    grid-template-columns: repeat(var(--col-count), minmax(86px, 1fr));
    gap: 0.45rem;
}

.board-header {
    min-height: 62px;
    padding: 0.5rem;
    border-radius: 9px;
    background: #ffce2e;
    color: #121212;
    font-weight: 700;
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
}

.clue-btn {
    min-height: 74px;
    border: 0;
    border-radius: 9px;
    background: linear-gradient(140deg, #2a43aa, #21337f);
    color: #fff;
    font-family: "Archivo Black", sans-serif;
    font-size: clamp(1rem, 2.2vw, 1.4rem);
    cursor: pointer;
}

.clue-btn:hover {
    transform: translateY(-1px);
}

.clue-btn.is-asked,
.clue-btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}

.clue-btn.is-empty {
    background: #6b7fbf;
}

.clue-modal {
    position: fixed;
    inset: 0;
    display: grid;
    place-items: center;
    background: rgba(3, 8, 22, 0.7);
    z-index: 30;
    padding: 1rem;
}

.clue-modal-card {
    width: min(680px, 100%);
    background: #ffffff;
    border-radius: 16px;
    padding: 1rem;
    border: 1px solid #d3ddfb;
    box-shadow: var(--shadow);
}

.clue-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    align-items: center;
}

.clue-modal-head h3 {
    margin: 0;
}

.icon-btn {
    border: 0;
    border-radius: 8px;
    padding: 0.35rem 0.55rem;
    background: #ebf1ff;
    cursor: pointer;
    font-weight: 700;
}

.clue-question,
.clue-answer {
    margin: 0.7rem 0;
    font-size: 1.05rem;
}

.clue-image-wrap {
    margin: 0.7rem 0;
    border: 1px solid #d7e0fa;
    border-radius: 10px;
    overflow: hidden;
    background: #f7f9ff;
}

.clue-image {
    display: block;
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    background: #f7f9ff;
}

.clue-choices-wrap {
    margin: 0.7rem 0;
    background: #f8fbff;
    border: 1px solid #d5e0fb;
    border-radius: 10px;
    padding: 0.6rem 0.75rem;
}

.clue-choices-title {
    margin: 0 0 0.35rem;
    font-weight: 700;
    color: #1c2f77;
}

.clue-choices {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: 0.28rem;
}

.clue-answer {
    background: #eef3ff;
    border-left: 4px solid #3653c5;
    border-radius: 8px;
    padding: 0.6rem;
}

.clue-modal-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

.btn-success {
    background: linear-gradient(130deg, #139a43, #1fba56);
    color: #fff;
}

.btn-danger {
    background: linear-gradient(130deg, #be2439, #e23d54);
    color: #fff;
}

.hidden {
    display: none !important;
}

.modal-open {
    overflow: hidden;
}

/* ===== Winner Overlay ===== */
.winner-overlay {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 20, 0.88);
    backdrop-filter: blur(4px);
}

.confetti-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
}

.confetti-piece {
    position: absolute;
    top: -18px;
    border-radius: 2px;
    opacity: 0.92;
    animation: confetti-fall linear forwards;
}

.confetti-circle {
    border-radius: 50%;
}

.confetti-strip {
    border-radius: 1px;
}

@keyframes confetti-fall {
    0%   { transform: translateY(0)      rotateZ(0deg)                      rotateX(0deg); opacity: 0.92; }
    80%  { opacity: 0.85; }
    100% { transform: translateY(105vh) rotateZ(calc(var(--spin, 1) * 600deg)) rotateX(360deg); opacity: 0; }
}

.winner-card {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
    padding: 2rem 2.5rem;
    animation: winner-pop 0.65s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.winner-trophy {
    font-size: clamp(4rem, 10vw, 7rem);
    line-height: 1;
    filter: drop-shadow(0 0 28px gold);
    animation: trophy-float 1.4s ease-in-out infinite;
    display: block;
    margin-bottom: 0.3rem;
}

.winner-title {
    margin: 0 0 0.25rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    font-size: 1.1rem;
    color: #ffbe0b;
    font-weight: 700;
}

.winner-name {
    margin: 0 0 0.4rem;
    font-family: "Archivo Black", sans-serif;
    font-size: clamp(2.4rem, 8vw, 5rem);
    line-height: 1.1;
    animation: glow-pulse 1.6s ease-in-out infinite;
}

.winner-score {
    margin: 0;
    font-size: 1.6rem;
    color: #a8c8ff;
    font-weight: 700;
}

.winner-close {
    margin-top: 1.8rem;
    font-size: 1rem;
    padding: 0.7rem 2.2rem;
}

@keyframes winner-pop {
    from { transform: scale(0.25) translateY(40px); opacity: 0; }
    to   { transform: scale(1) translateY(0);       opacity: 1; }
}

@keyframes trophy-float {
    0%, 100% { transform: translateY(0)    rotate(-4deg); }
    50%       { transform: translateY(-14px) rotate(4deg);  }
}

@keyframes glow-pulse {
    0%, 100% { text-shadow: 0 0 30px rgba(255, 190, 11, 0.7), 0 0 60px rgba(255, 190, 11, 0.2); }
    50%       { text-shadow: 0 0 60px rgba(255, 190, 11, 1),   0 0 100px rgba(255, 190, 11, 0.5); }
}

@media (max-width: 980px) {
    .play-layout {
        grid-template-columns: 1fr;
    }

    .board-grid {
        grid-template-columns: repeat(var(--col-count), minmax(80px, 1fr));
    }
}

@media (max-width: 760px) {
    .top-header {
        margin-top: 0.8rem;
        padding: 0.7rem;
    }

    .hero {
        padding: 1rem;
    }

    .editor-toolbar {
        grid-template-columns: 1fr 1fr;
    }

    .editor-actions {
        flex-direction: column;
    }

    .copy-row {
        grid-template-columns: 1fr;
    }
}
