/* puzzle.css */

/* Genel tema – Rohan2 */
:root {
    --r2-bg: #0a1204;
    --r2-bg-alt: #111a06;
    --r2-bg-card: rgba(15, 24, 6, 0.96);
    --r2-border-soft: rgba(246, 216, 122, 0.22);
    --r2-gold: #f6d87a;
    --r2-gold-soft: rgba(246, 216, 122, 0.18);
    --r2-red: #0a100c;
    --r2-red-soft: rgba(224, 113, 43, 0.28);
    --r2-text: #f7f4e6;
    --r2-text-muted: #b8c08f;
    --r2-radius-lg: 20px;
    --r2-radius-xl: 26px;
    --r2-shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.65);
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.r2-body {
    margin: 0;
    min-height: 100vh;
    font-family: 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    color: var(--r2-text);
    background:
        radial-gradient(circle at top, rgba(246, 216, 122, 0.24), transparent 55%),
        radial-gradient(circle at bottom, rgba(44, 66, 18, 0.75), transparent 68%),
        linear-gradient(135deg, #070d02, #111a06 32%, #18240a 72%, #111707 100%);
    background-attachment: fixed;
    position: relative;
    overflow-x: hidden;
}

/* Parallax benzeri hafif orb efekti */
body.r2-body::before {
    content: "";
    position: fixed;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(246, 216, 122, 0.25), transparent 70%);
    top: -140px;
    right: -60px;
    opacity: 0.5;
    pointer-events: none;
    filter: blur(1px);
    animation: r2-orb-move 22s ease-in-out infinite alternate;
    z-index: -1;
}

@keyframes r2-orb-move {
    0% { transform: translate3d(0, 0, 0); }
    100% { transform: translate3d(-40px, 60px, 0); }
}

/* Sayfa iskeleti */

.r2-puzzle-page {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 16px 32px;
}

/* Header */

.r2-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
    padding: 14px 18px;
    border-radius: 999px;
    border: 1px solid rgba(246, 216, 122, 0.3);
    background: radial-gradient(circle at top left, rgba(246, 216, 122, 0.07), transparent 55%),
                radial-gradient(circle at bottom right, rgba(44, 66, 18, 0.6), transparent 60%),
                rgba(7, 11, 3, 0.9);
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(18px);
}

.r2-logo-title {
    display: flex;
    align-items: center;
    gap: 14px;
}

.r2-logo-circle {
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: radial-gradient(circle at 30% 20%, #fef4d7, #072d0f 20%, #a3db788c 85%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 24px rgba(246, 216, 122, 0.7);
}

.r2-logo-r {
    font-family: 'Cinzel', serif;
    font-size: 24px;
    color: #ddd7c5;
    font-weight: 700;
}

.r2-title {
    font-family: 'Cinzel', serif;
    font-size: 22px;
    letter-spacing: 0.03em;
    margin: 0;
}

.r2-subtitle {
    margin: 3px 0 0;
    font-size: 13px;
    color: var(--r2-text-muted);
}

.r2-header-pill {
    display: flex;
    align-items: center;
    justify-content: center;
}

.r2-header-pill .pill-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.14em;
    padding: 6px 14px;
    border-radius: 999px;
    border: 1px solid rgba(58 109 67);
    background: radial-gradient(circle at top, rgba(10 53 18), rgba(10 53 18));
    box-shadow: 0 0 24px rgba(28 103 44);
}

/* Ana layout */

.r2-main {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.r2-card {
    border-radius: var(--r2-radius-xl);
    border: 1px solid var(--r2-border-soft);
    background: linear-gradient(145deg, rgba(18, 28, 9, 0.98), rgba(8, 12, 4, 0.98));
    box-shadow: var(--r2-shadow-soft);
    padding: 18px 18px 20px;
}

.r2-card-main {
    padding: 20px 20px 22px;
}

.r2-card-header h2 {
    margin: 0 0 4px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--r2-gold);
}

.r2-card-header p {
    margin: 0;
    color: var(--r2-text-muted);
    font-size: 13px;
}

.r2-lore {
    margin-top: 8px;
    font-size: 12px;
    color: var(--r2-text-muted);
    font-style: italic;
}

.r2-event-range {
    margin-top: 6px;
    font-size: 11px;
    color: var(--r2-text-muted);
}

.r2-game-layout {
    margin-top: 18px;
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 1.7fr);
    gap: 18px;
}

.r2-canvas-wrapper {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.r2-canvas-inner {
    position: relative;
    border-radius: var(--r2-radius-lg);
    border: 1px solid rgba(246, 216, 122, 0.22);
    overflow: hidden;
    background: radial-gradient(circle at top, rgba(246, 216, 122, 0.12), transparent 55%),
                radial-gradient(circle at bottom, rgba(44, 66, 18, 0.35), transparent 60%),
                #020402;
    transition: transform 0.3s ease-out, box-shadow 0.3s ease-out;
}

.r2-canvas-inner::before,
.r2-canvas-inner::after {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 18px;
    border: 1px dashed rgba(246, 216, 122, 0.23);
    pointer-events: none;
    opacity: 0.75;
}

.r2-canvas-inner::after {
    inset: 12px;
    border-radius: 14px;
    border-style: solid;
    border-color: rgba(120, 130, 90, 0.4);
    opacity: 0.5;
}

.r2-canvas-inner.r2-canvas-completed {
    transform: scale(1.02);
    box-shadow: 0 0 35px rgba(246, 216, 122, 0.7);
}

/* Canvas responsive */

#puzzleCanvas {
    width: 100%;
    height: auto;
    display: block;
}

/* Loading overlay */

.r2-loading-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(246, 216, 122, 0.12), transparent 60%),
                rgba(7, 11, 3, 0.93);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    z-index: 3;
}

.r2-loading-overlay p {
    margin: 0;
    font-size: 13px;
    color: var(--r2-text-muted);
}

.r2-spinner {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    border: 3px solid rgba(246, 216, 122, 0.18);
    border-top-color: var(--r2-gold);
    animation: r2-spin 0.8s linear infinite;
}

@keyframes r2-spin {
    to { transform: rotate(360deg); }
}

/* Geri sayım overlay */

.r2-countdown-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top, rgba(245, 243, 232, 0.08), transparent 60%),
                rgba(7, 11, 3, 0.96);
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    z-index: 2;
}

.r2-countdown-content {
    max-width: 320px;
    padding: 16px 14px;
    border-radius: 18px;
    border: 1px solid rgba(246, 216, 122, 0.35);
    background: radial-gradient(circle at top, rgba(246, 216, 122, 0.16), transparent 65%),
                rgba(10, 16, 4, 0.96);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
}

.r2-countdown-title {
    margin: 0 0 6px;
    font-size: 15px;
    font-weight: 600;
    color: var(--r2-gold);
}

.r2-countdown-text {
    margin: 0 0 10px;
    font-size: 12px;
    color: var(--r2-text-muted);
}

.r2-countdown-number {
    font-family: 'Cinzel', serif;
    font-size: 40px;
    margin-bottom: 6px;
    color: var(--r2-gold);
    text-shadow: 0 0 16px rgba(246, 216, 122, 0.7);
}

/* Nickname Input Alanı */
.r2-nickname-group {
    margin-bottom: 14px;
    width: 100%;
    max-width: 240px;
}

.r2-nickname-input {
    width: 100%;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid rgba(246, 216, 122, 0.4);
    background: rgba(3, 7, 18, 0.8);
    color: var(--r2-gold);
    font-family: 'Roboto', sans-serif;
    font-size: 14px;
    text-align: center;
    outline: none;
    transition: all 0.2s ease;
}

.r2-nickname-input:focus {
    border-color: var(--r2-gold);
    box-shadow: 0 0 15px rgba(246, 216, 122, 0.25);
    background: rgba(10, 16, 4, 0.95);
}

.r2-nickname-input::placeholder {
    color: rgba(184, 192, 143, 0.5);
}

/* İlk giriş tooltip */

.r2-intro-tooltip {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 4;
    display: none;
}

.r2-intro-tooltip.visible {
    display: block;
}

.r2-intro-inner {
    max-width: 260px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid rgba(246, 216, 122, 0.7);
    background: rgba(11, 18, 6, 0.98);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.75);
    font-size: 11px;
    color: var(--r2-text-muted);
}

.r2-intro-title {
    margin: 0 0 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--r2-gold);
}

.r2-intro-text {
    margin: 0 0 6px;
}

.r2-intro-close {
    border-radius: 999px;
    border: 1px solid rgba(246, 216, 122, 0.7);
    background: rgba(15, 23, 42, 1);
    color: var(--r2-text);
    font-size: 11px;
    padding: 3px 10px;
    cursor: pointer;
}

/* Hint */

.r2-hint {
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px dashed rgba(246, 216, 122, 0.35);
    background: linear-gradient(135deg, rgba(246, 216, 122, 0.12), rgba(18, 28, 9, 0.98));
    font-size: 12px;
    color: var(--r2-text-muted);
}

.hint-title {
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    font-size: 11px;
    color: var(--r2-gold);
}

.r2-hint ul {
    margin: 6px 0 0;
    padding-left: 16px;
}

.r2-hint li {
    margin-bottom: 2px;
}

/* Sidebar */

.r2-sidebar {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.r2-card-stats h3,
.r2-card-info h3,
.r2-card-event h3,
.r2-card-top h3 {
    margin: 0 0 10px;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--r2-gold);
}

.r2-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 13px;
}

.r2-stat-row:last-child {
    border-bottom: none;
}

.r2-stat-row span:last-child {
    font-weight: 500;
}

/* Süre renkleri */

.r2-time {
    transition: color 0.2s ease-out;
}

.r2-time-good {
    color: #bbf7d0;
}

.r2-time-ok {
    color: #facc15;
}

.r2-time-bad {
    color: #fecaca;
}

/* Combo badge */

.r2-combo-badge {
    margin-top: 4px;
    font-size: 11px;
    color: var(--r2-gold);
    opacity: 0;
    transform: translateY(4px) scale(0.96);
    pointer-events: none;
    transition: opacity 0.18s ease-out, transform 0.18s ease-out;
}

.r2-combo-badge.visible {
    opacity: 1;
    transform: translateY(0) scale(1);
}

/* Buttons */

.r2-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 10px;
    width: 100%;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s ease-out;
    text-decoration: none;
    background: none;
    color: inherit;
}

.r2-btn-inline {
    width: auto;
    min-width: 120px;
}

.r2-btn-primary {
    background: linear-gradient(135deg, var(--r2-red), #0a3c14);
    border-color: rgba(255, 255, 255, 0.16);
    box-shadow: 0 10px 25px rgba(30, 63, 31, 1);
}

.r2-btn-primary:hover {
    filter: brightness(1.05);
    transform: translateY(-1px);
}

.r2-btn-secondary {
    background: rgba(10, 16, 4, 0.98);
    border-color: rgba(180, 190, 130, 0.5);
}

.r2-btn-secondary:hover {
    border-color: rgba(246, 216, 122, 0.8);
}

/* Kurallar listesi */

.r2-rules {
    margin: 2px 0 0;
    padding-left: 18px;
    font-size: 12px;
    color: var(--r2-text-muted);
}

.r2-rules li {
    margin-bottom: 4px;
}

/* Kontrol grupları */

.r2-control-group {
    margin-top: 12px;
    font-size: 12px;
}

.r2-control-group label {
    display: block;
    margin-bottom: 4px;
    color: var(--r2-text-muted);
}

/* Ses & ipucu toggle */

.r2-control-sound {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* Checkbox tarzı ses kontrolü */

.r2-check-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
}

.r2-check-label input {
    display: none;
}

.r2-check-box {
    width: 17px;
    height: 17px;
    border-radius: 4px;
    border: 1px solid rgba(180, 190, 130, 0.9);
    background: rgba(10, 16, 4, 0.96);
    box-shadow: 0 0 0 1px rgba(3, 7, 18, 0.9);
    position: relative;
    flex-shrink: 0;
}

.r2-check-label input:checked + .r2-check-box {
    background: linear-gradient(135deg, var(--r2-gold), #f97316);
    border-color: rgba(248, 250, 252, 0.9);
    box-shadow: 0 0 12px rgba(250, 204, 21, 0.7);
}

.r2-check-box::after {
    content: "";
    position: absolute;
    inset: 0;
    display: block;
    opacity: 0;
    transform: scale(0.6);
    transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}

.r2-check-label input:checked + .r2-check-box::after {
    content: "✓";
    opacity: 1;
    transform: scale(1);
    color: #0b1020;
    font-size: 11px;
    text-align: center;
    line-height: 17px;
}

.r2-check-text {
    font-size: 12px;
    color: var(--r2-text-muted);
}

/* Event kartı */

.r2-card-event {
    margin-top: 4px;
}

.r2-event-name {
    margin: 0 0 2px;
    font-size: 13px;
    font-weight: 500;
}

.r2-event-date {
    margin: 0;
    font-size: 12px;
    color: var(--r2-text-muted);
}

.r2-event-links {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.r2-link {
    font-size: 12px;
    color: var(--r2-gold);
    text-decoration: none;
    position: relative;
}

.r2-link::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 0;
    height: 1px;
    background: linear-gradient(90deg, var(--r2-gold), #f97316);
    transition: width 0.15s ease-out;
}

.r2-link:hover::after {
    width: 100%;
}

/* Eski Top 3 kartı (şu an kullanılmıyor ama kalsın) */

.r2-card-top {
    margin-top: 4px;
}

.r2-top-empty {
    margin: 0;
    font-size: 12px;
    color: var(--r2-text-muted);
}

.r2-top-list {
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: 12px;
}

.r2-top-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    padding: 4px 0;
    border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}

.r2-top-list li:last-child {
    border-bottom: none;
}

.r2-top-rank {
    font-size: 11px;
    color: var(--r2-gold);
    min-width: 28px;
}

.r2-top-time {
    font-weight: 500;
}

.r2-top-moves {
    font-size: 11px;
    color: var(--r2-text-muted);
}

/* Kısayol bilgilendirmesi */

.r2-shortcuts {
    margin-top: 8px;
    font-size: 11px;
    color: var(--r2-text-muted);
}

/* Footer */

.r2-footer {
    margin-top: 18px;
    text-align: center;
    font-size: 11px;
    color: var(--r2-text-muted);
    opacity: 0.8;
}

/* Modal */

.r2-modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: radial-gradient(circle at top, rgba(246, 216, 122, 0.12), transparent 60%),
                rgba(3, 7, 18, 0.94);
    backdrop-filter: blur(12px);
    z-index: 999;
}

.r2-modal-backdrop.active {
    display: flex;
}

.r2-modal {
    max-width: 480px;
    width: 100%;
    margin: 0 16px;
    padding: 20px 18px 18px;
    border-radius: var(--r2-radius-xl);
    border: 1px solid rgba(246, 216, 122, 0.45);
    background: radial-gradient(circle at top, rgba(246, 216, 122, 0.14), transparent 65%),
                rgba(10, 16, 4, 0.98);
    box-shadow: 0 22px 60px rgba(0, 0, 0, 0.78);
}

.r2-modal h2 {
    margin: 0 0 8px;
    font-family: 'Cinzel', serif;
    font-size: 20px;
}

.r2-modal-time {
    margin: 0 0 10px;
    font-size: 13px;
    color: var(--r2-text-muted);
}

.r2-modal-code-section p {
    margin: 4px 0;
    font-size: 13px;
}

.r2-code-box {
    display: flex;
    margin-top: 6px;
    margin-bottom: 6px;
    border-radius: 999px;
    border: 1px solid rgba(246, 216, 122, 0.7);
    background: rgba(3, 7, 18, 0.9);
    overflow: hidden;
}

#winnerCode {
    flex: 1;
    padding: 7px 12px;
    font-family: monospace;
    font-size: 13px;
    letter-spacing: 0.14em;
}

.r2-btn-copy {
    border: none;
    outline: none;
    padding: 0 12px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    border-left: 1px solid rgba(148, 163, 184, 0.5);
    background: linear-gradient(135deg, rgba(246, 216, 122, 0.18), rgba(15, 23, 42, 1));
    color: var(--r2-text);
}

.r2-btn-copy:hover {
    filter: brightness(1.1);
}

.r2-modal-note {
    margin-top: 4px;
    font-size: 11px;
    color: var(--r2-text-muted);
}

.r2-modal-error-section {
    margin-top: 10px;
}

.r2-error-text {
    margin: 0;
    font-size: 12px;
    color: #fecaca;
}

.r2-modal-actions {
    margin-top: 14px;
    display: flex;
    gap: 10px;
}

/* Responsive */

@media (max-width: 900px) {
    .r2-header {
        flex-direction: column;
        align-items: flex-start;
        border-radius: 20px;
    }

    .r2-game-layout {
        grid-template-columns: minmax(0, 1fr);
    }

    .r2-modal {
        margin: 0 10px;
    }
}

@media (max-width: 600px) {
    .r2-puzzle-page {
        padding-inline: 10px;
    }

    .r2-card-main {
        padding: 16px 14px 18px;
    }

    .r2-header {
        padding-inline: 14px;
    }

    .r2-title {
        font-size: 19px;
    }

    .r2-stat-row {
        font-size: 12px;
    }

    .r2-btn {
        padding: 11px 18px;
    }

    .r2-countdown-content {
        padding-inline: 12px;
    }

    .r2-intro-inner {
        max-width: 220px;
    }
}

/* --- TOP 5 – yeni kart ve ikonlu görünüm --- */

.r2-leaderboard-box {
    margin-top: 10px;
    padding: 16px 20px;
    border-radius: 18px;
    border: 1px solid rgba(246, 216, 122, 0.22);
    background: linear-gradient(145deg, rgba(18, 28, 9, 0.98), rgba(8, 12, 4, 0.98));
    box-shadow: 0 10px 30px rgba(0,0,0,0.55);
}

.r2-leaderboard-box h3 {
    margin: 0 0 10px;
    font-size: 15px;
    text-transform: uppercase;
    letter-spacing: 0.13em;
    color: var(--r2-gold);
}

/* Liste */
.r2-leaderboard-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.r2-leaderboard-item {
    display: grid;
    grid-template-columns: 56px 1fr auto;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    font-size: 14px;
}

.r2-leaderboard-item:last-child {
    border-bottom: none;
}

/* # numara + ikon alanı */
.r2-leaderboard-rank {
    color: var(--r2-gold);
    font-weight: 600;
    position: relative;
    padding-left: 24px;
}

.r2-leaderboard-rank::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    font-size: 15px;
    filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.7));
}

/* Sıralamaya göre ikonlar */
.r2-leaderboard-list li:nth-child(1) .r2-leaderboard-rank::before {
    content: '🥇';
}

.r2-leaderboard-list li:nth-child(2) .r2-leaderboard-rank::before {
    content: '🥈';
}

.r2-leaderboard-list li:nth-child(3) .r2-leaderboard-rank::before {
    content: '🥉';
}

.r2-leaderboard-list li:nth-child(4) .r2-leaderboard-rank::before,
.r2-leaderboard-list li:nth-child(5) .r2-leaderboard-rank::before {
    content: '🎖️';
}

/* Nickname */
.r2-leaderboard-nick {
    color: #e2e8f0;
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 1px;
}

/* süre */
.r2-leaderboard-time {
    text-align: center;
    font-weight: 500;
}

/* hamle */
.r2-leaderboard-moves {
    color: var(--r2-text-muted);
    font-size: 13px;
}