/* =============================================================================
   1. CSS Custom Properties
   ============================================================================= */
:root {
    /* Barvy */
    --color-primary:         #4CAF50;
    --color-primary-hover:   #45a049;
    --color-primary-dark:    #2e7d32;
    --color-primary-light:   #e8f5e9;
    --color-primary-done:    #c8e6c9;
    --color-secondary:       #2196F3;
    --color-secondary-hover: #0b7dda;
    --color-danger:          #f44336;
    --color-warning:         #FFC107;
    --color-warning-light:   #fff9c4;
    --color-text:            #333;
    --color-text-muted:      #666;
    --color-btn-muted:       #999;
    --color-border:          #ddd;
    --color-bg:              #f5f5f5;
    --color-bg-thumb:        #f0f0f0;
    --color-black:           #000;
    --color-white:           #fff;

    /* Border radius */
    /* Gold / victory */
    --color-gold:          #c4a243;
    --color-gold-dark:     #b89435;
    --color-gold-text:     #5d4215;

    /* Border radius */
    --radius-sm:   8px;   /* inputy, thumbnail, malá tlačítka */
    --radius-md:   12px;  /* karty, kontejnery, hlavní btn */
    --radius-lg:   20px;  /* steps panel */
    --radius-full: 50%;   /* kruhová tlačítka */
}

/* =============================================================================
   2. Reset & Base
   ============================================================================= */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    touch-action: pan-y;          /* block pinch-zoom & double-tap zoom globally */
}

/* Fullscreen photo viewer — allow pinch-to-zoom (custom JS handler) */
.photo-fullscreen,
.photo-fullscreen * {
    touch-action: none;           /* JS handles all touch gestures here */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--color-bg);
    overflow: hidden;
    height: 100vh;
}

/* =============================================================================
   3. Layout
   ============================================================================= */
.screen {
    display: none;
    position: fixed;
    inset: 0;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.container {
    flex: 1;
    min-height: 0;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    padding: 90px 20px 20px;
    overflow-y: auto;
    box-sizing: border-box;
}

.screen-header {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    z-index: 10;
    background: var(--color-bg);
    transition: transform 0.3s ease;
}

.screen-header.header-hidden {
    transform: translateY(-100%);
}

.screen-header-spacer {
    width: 50px;
    height: 50px;
    flex-shrink: 0;
}

.start-logo {
    height: 50px;
    width: auto;
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.screen-header-title {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 18px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 10px;
}

.screen-header .avatar-widget {
    position: static;
}

/* =============================================================================
   4. Buttons
   ============================================================================= */
.btn {
    padding: 16px 24px;
    font-size: 18px;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

.btn-primary:hover {
    background: var(--color-primary-hover);
}

.btn-primary:active {
    transform: scale(0.98);
}

.btn-secondary {
    background: var(--color-secondary);
    color: var(--color-white);
}

.btn-secondary:hover {
    background: var(--color-secondary-hover);
}

.btn-secondary:active {
    transform: scale(0.98);
}

.btn-ghost {
    background: rgba(255, 255, 255, 0.9);
    color: var(--color-text);
    padding: 8px 16px;
    font-size: 14px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
}

.btn-small {
    padding: 8px 16px;
    font-size: 14px;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-back {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--color-btn-muted);
    color: var(--color-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-circle {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-text);
    background: var(--color-white);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-lock {
    background: var(--color-btn-muted);
    border: none;
    border-radius: var(--radius-full);
    width: 50px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
    transition: background 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-white);
}

.btn-lock.unlocked {
    background: var(--color-primary);
}

.btn-lock .icon-unlocked { display: none; }
.btn-lock.unlocked .icon-locked { display: none; }
.btn-lock.unlocked .icon-unlocked { display: flex; }

/* =============================================================================
   5. Forms
   ============================================================================= */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--color-text);
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
}

.form-group textarea {
    min-height: 100px;
    resize: vertical;
    font-family: monospace;
}

/* =============================================================================
   6. Utilities
   ============================================================================= */
.hidden {
    display: none !important;
}

.auth-loading {
    visibility: hidden;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* =============================================================================
   7. Start Screen
   ============================================================================= */
#startScreen .container {
    display: flex;
    flex-direction: column;
    padding-top: 4rem;
}

.hero-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Intro Carousel */
.intro-carousel {
    flex: 1;
    width: 100%;
    overflow: hidden;
    display: flex;
    align-items: center;
    min-height: 0;
}

.intro-slides {
    display: flex;
    width: 100%;
    transition: transform 0.3s ease;
}

.intro-slide {
    min-width: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0 20px;
    box-sizing: border-box;
}

.intro-slide-img {
    display: block;
    width: min(340px, 70vw);
    max-height: 45vh;
    height: auto;
    object-fit: contain;
}

.intro-slide-text {
    margin-top: 12px;
    font-size: 1.5rem;
    color: var(--color-text);
    text-align: center;
}

#introHowToPlay {
    cursor: pointer;
}

.intro-slide-link {
    background: none;
    border: none;
    color: var(--color-secondary);
    font-size: 14px;
    cursor: pointer;
    margin-top: 4px;
    padding: 4px 8px;
}

.intro-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
    padding: 16px 0;
}

.intro-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-btn-muted);
    opacity: 0.4;
    transition: opacity 0.2s;
}

.intro-dot.active {
    opacity: 1;
}

#startScreen .button-group {
    margin-top: 16px;
}

/* =============================================================================
   8. Create Screen
   ============================================================================= */
.create-section {
    margin-top: 2rem;
}

#gameName {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    box-sizing: border-box;
}

/* Stepper — vertical line + circles */
.stepper {
    position: relative;
    padding-left: 24px;
}

/* Vertical line — clipped between first step circle center and Add button circle center */
.stepper::before {
    content: '';
    position: absolute;
    left: 5px;
    top: 24px;       /* first circle center: step-item top (0) + circle top (18px) + radius (6px) */
    bottom: 24px;    /* Add button circle center from bottom: button height / 2 */
    width: 2px;
    background: var(--color-border);
}

/* Filled circle on each step — aligned with step-number text */
.stepper .step-item {
    position: relative;
}

.stepper .step-item::before {
    content: '';
    position: absolute;
    left: -26px;          /* -24px stepper padding - 2px step-item border */
    top: 18px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--color-border);
    z-index: 1;
}

/* Add button — with outline circle */
.btn-add-step {
    position: relative;
    display: inline-block;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    background: var(--color-secondary);
    color: var(--color-white);
    transition: background 0.2s;
    box-sizing: border-box;
}

.btn-add-step::before {
    content: '';
    position: absolute;
    left: -24px;
    top: 50%;
    transform: translateY(-50%);
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid var(--color-border);
    background: var(--color-bg);
    box-sizing: border-box;
    z-index: 1;
}

.btn-add-step:hover {
    background: var(--color-secondary-hover);
}

.steps-list {
    margin: 0;
}

.step-item {
    background: var(--color-white);
    border: 2px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 15px;
}

.step-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.step-number {
    font-weight: 600;
    color: var(--color-text-muted);
}

.step-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.step-move,
.step-remove {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px 6px;
    line-height: 1;
    border-radius: var(--radius-sm);
}

.step-move {
    color: var(--color-text-muted);
}

.step-move:disabled {
    opacity: 0.25;
    cursor: default;
}

.step-remove {
    color: var(--color-danger);
}

.photo-upload-btn {
    display: block;
    width: 100%;
    padding: 12px 24px;
    font-size: 16px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: center;
    background: var(--color-secondary);
    color: var(--color-white);
    margin-bottom: 10px;
    transition: background 0.2s;
    box-sizing: border-box;
}

.photo-upload-btn:hover {
    background: var(--color-secondary-hover);
}

.photo-upload-btn--filled,
.photo-upload-btn--filled:hover {
    background: #9e9e9e;
}

.photo-upload-btn .photo-input {
    display: none;
}

.instruction-toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--color-text-muted);
    cursor: pointer;
    margin: 4px 0 8px;
}

.step-item input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    margin-bottom: 10px;
}

.step-preview-wrapper {
    position: relative;
    margin-top: 10px;
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.step-preview {
    display: block;
    max-width: 100%;
}

.step-preview-instruction {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    margin: 0;
    padding: 8px 12px;
    background: rgba(0, 0, 0, 0.65);
    color: var(--color-white);
    font-size: 13px;
    line-height: 1.4;
}

.step-item label {
    display: block;
    margin-top: 10px;
    font-size: 14px;
}

.step-item input[type="checkbox"] {
    margin-right: 8px;
}

.step-field-label {
    display: block;
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 4px 0 8px;
}

.step-password-hint {
    margin: -6px 0 10px;
    font-size: 12px;
    color: var(--color-text-muted);
}

/* Share Link */
.share-link {
    margin-top: 30px;
    padding: 20px;
    background: var(--color-primary-light);
    border-radius: var(--radius-md);
}

.share-link p {
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--color-primary-dark);
}

.link-container {
    display: flex;
    gap: 10px;
}

.link-container input {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--color-primary);
    border-radius: var(--radius-sm);
    font-size: 16px;
    font-family: monospace;
}

.section-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
}

/* Create Controls — fixed bottom panel */
.create-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-white);
    padding: 15px;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px;
    z-index: 30;
}

.create-controls .btn {
    width: auto;
}

.create-controls #btnDeleteGame {
    margin-right: auto;
}

.create-controls .btn-menu-float:disabled {
    opacity: 0.3;
    cursor: default;
}

.btn-menu-float.btn-icon-danger {
    background: var(--color-danger);
}

#createScreen .container,
#editLinkScreen .container {
    padding-bottom: 100px;
}

#editLinkScreen .create-controls {
    justify-content: center;
}

#editLinkScreen .create-controls .btn {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
}

/* =============================================================================
   9. Play Screen
   ============================================================================= */
.game-container {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 600px;
    background: var(--color-white);
    overflow: hidden;  /* clips translateY(100%) steps-panel so it stays invisible */
}

/* Top Header — menu + avatar */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px;
}

.game-header-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    padding: 0 10px;
    min-width: 0;
}

.game-header-title {
    font-weight: 600;
    font-size: 16px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
}

.game-header-progress {
    font-size: 11px;
    color: var(--color-text-muted);
    margin-top: 2px;
}

.photo-view {
    position: relative;
    margin: 0 12px;
    height: calc(100% - 80px - 80px);  /* viewport − header − bottom-controls */
    background: var(--color-black);
    border-radius: 2rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: pan-y;
}

.photo-view img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.photo-overlay {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    padding: 20px;
}

.step-instruction-display {
    background: rgba(0, 0, 0, 0.65);
    color: var(--color-white);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 15px;
    margin: 0 auto 10px;
    width: 100%;
    box-sizing: border-box;
}

/* Clue Input — inline in bottom-controls */
.bottom-clue-input {
    flex: 1;
    min-width: 0;              /* allow shrinking below content size */
    height: 50px;
    padding: 0 14px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    text-align: center;
    margin: 0 15px;
    box-sizing: border-box;
}

/* Completed clue display — replaces input on completed steps */
.bottom-clue-completed {
    flex: 1;
    min-width: 0;
    height: 50px;
    margin: 0 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.clue-completed-password {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-primary-dark);
}

.clue-completed-check {
    color: var(--color-primary);
    flex-shrink: 0;
}

/* Menu Button (in game-header) */
.btn-menu-float {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    border: none;
    background: var(--color-btn-muted);
    color: var(--color-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Bottom Controls */
.bottom-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--color-white);
    padding: 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 30;
}

/* Nav Arrow Buttons (prev/next step) */
.btn-nav-arrow {
    background: none;
    border: none;
    border-radius: var(--radius-full);
    width: 50px;
    height: 50px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--color-black);
    transition: opacity 0.2s;
}

.btn-nav-arrow:disabled {
    opacity: 0.2;
    cursor: default;
}

#stepperModal .modal-sheet {
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.steps-list-panel {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    min-height: 0;
}

/* Step Cards (v steps panelu) */
.step-card {
    background: var(--color-white);
    border: 3px solid var(--color-border);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-bottom: 12px;
    display: flex;
    gap: 15px;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.step-card.completed {
    background: var(--color-primary-done);
    border-color: var(--color-primary);
}

.step-card.active {
    background: var(--color-warning-light);
    border-color: var(--color-warning);
}

.step-card.locked {
    opacity: 0.6;
}

.step-card-number {
    font-weight: 600;
    color: var(--color-text-muted);
    min-width: 20px;
}

.step-card-thumb {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: var(--color-bg-thumb);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.step-card-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: var(--radius-sm);
}

.step-card-info {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-left: 6px;
}

.step-card-status {
    font-size: 24px;
}

.step-card.completed .step-card-status {
    color: var(--color-primary);
}

.step-card.locked .step-card-status {
    color: #999;
}

.step-card-password {
    font-size: 16px;
    font-weight: 500;
    color: var(--color-primary-dark);
    letter-spacing: 0.02em;
}

/* Victory step — editor card */
.step-item-victory {
    background: linear-gradient(160deg, #f5ecc5 0%, #e2d070 45%, #ecdea0 100%);
    border: 2px solid var(--color-gold);
    border-radius: var(--radius-md);
    padding: 15px;
    margin-top: 15px;
}

.step-item-victory .step-header {
    display: flex;
    align-items: center;
    margin-bottom: 10px;
}

.step-item-victory .step-number {
    font-weight: 700;
    color: var(--color-gold-text);
}

/* Victory step — play panel card */
.step-card.victory {
    background: linear-gradient(160deg, #f5ecc5 0%, #e2d070 45%, #ecdea0 100%);
    border-color: var(--color-gold);
}

.step-card.victory .step-card-number {
    color: var(--color-gold-text);
    font-weight: 700;
}

.step-card.victory .step-card-thumb {
    background: var(--color-gold);
    color: var(--color-white);
}

.step-card.victory .step-card-status {
    color: var(--color-gold);
}

.step-card.victory.active {
    border-color: var(--color-gold-dark);
}

/* Victory mode — play screen */
.game-container.victory-mode .bottom-clue-input,
.game-container.victory-mode .bottom-clue-completed,
.game-container.victory-mode .btn-lock {
    display: none;
}

/* Victory buttons (Restart + Finish) */
.victory-buttons {
    display: flex;
    flex: 1;
    gap: 10px;
    margin-left: 15px;
}

.btn-victory {
    flex: 1;
    height: 50px;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 600;
    border: none;
    cursor: pointer;
}

.btn-victory-secondary {
    background: var(--color-bg);
    color: var(--color-black);
    border: 2px solid var(--color-border);
}

.btn-victory-primary {
    background: var(--color-primary);
    color: var(--color-white);
}

/* Bounce-in animation (every step transition + victory) */
@keyframes bounce-in {
    0%   { opacity: 0; transform: scale(0.3); }
    50%  { opacity: 1; transform: scale(1.08); }
    70%  { transform: scale(0.95); }
    100% { opacity: 1; transform: scale(1); }
}

.photo-view img.bounce-in {
    animation: bounce-in 0.8s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Temporary next-photo for carousel swipe */
.photo-view .swipe-next {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* Confetti (continuous falling pieces inside photo-view) */
.confetti-container {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 5;
}

.confetti-piece {
    position: absolute;
    top: -20px;
    animation: confetti-fall linear infinite;
}

@keyframes confetti-fall {
    0%   { opacity: 0.8; transform: translateY(0) translateX(0) rotateZ(0deg) rotateX(0deg); }
    100% { opacity: 0; transform: translateY(var(--fall-h)) translateX(var(--sway)) rotateZ(var(--rot-z)) rotateX(var(--rot-x)); }
}

/* =============================================================================
   10. Avatar Widget
   ============================================================================= */
.avatar-widget {
    width: 50px;
    height: 50px;
    border-radius: var(--radius-full);
    border: 2px solid var(--color-border);
    background: var(--color-bg);
    color: var(--color-text-muted);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 10;
    transition: background 0.2s, color 0.2s, border-color 0.2s;
    flex-shrink: 0;
}

/* Avatar in game-header: not absolutely positioned */
.game-header .avatar-widget {
    position: static;
}

.avatar-widget.avatar-logged-in {
    background: var(--color-primary);
    color: var(--color-white);
    border-color: var(--color-primary);
}


/* =============================================================================
   11. Bottom Sheet / Modal — shared by auth modal, game menu, and user account sheet
   ============================================================================= */
@keyframes slideInUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.hidden {
    display: none !important;
}

.modal-sheet {
    background: var(--color-white);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px 24px 44px;
    width: 100%;
    max-width: 500px;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideInUp 0.25s ease;
}

.modal-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 4px 8px;
}

.modal-title {
    text-align: center;
    font-size: 20px;
    margin-bottom: 20px;
}

.auth-tabs {
    display: flex;
    border-bottom: 2px solid var(--color-border);
    margin-bottom: 20px;
}

.auth-tab {
    flex: 1;
    padding: 10px;
    background: none;
    border: none;
    border-bottom: 3px solid transparent;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    color: var(--color-text-muted);
    margin-bottom: -2px;
    transition: color 0.15s;
    font-family: inherit;
}

.auth-tab.active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.auth-fields {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
}

.auth-fields input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-size: 16px;
    box-sizing: border-box;
    font-family: inherit;
    transition: border-color 0.15s;
}

.auth-fields input:focus {
    border-color: var(--color-primary);
    outline: none;
}

.auth-error {
    color: var(--color-danger);
    font-size: 14px;
    margin-bottom: 12px;
    text-align: center;
    min-height: 20px;
}

.auth-success {
    color: var(--color-primary-dark);
    background: var(--color-primary-light);
    font-size: 14px;
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 8px;
    text-align: center;
}

.auth-forgot {
    background: none;
    border: none;
    color: var(--color-text-muted);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    text-decoration: underline;
    display: block;
    margin: 16px auto 0;
}

.reset-password-form {
    max-width: 360px;
    margin: 40px auto 0;
}

.auth-divider {
    text-align: center;
    position: relative;
    margin: 16px 0;
    color: var(--color-text-muted);
    font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    position: absolute;
    top: 50%;
    width: 38%;
    height: 1px;
    background: var(--color-border);
}

.auth-divider::before { left: 0; }
.auth-divider::after  { right: 0; }

.btn-google {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    background: var(--color-white);
    border: 2px solid var(--color-border);
    color: var(--color-text);
    font-weight: 600;
    padding: 14px;
    border-radius: var(--radius-md);
    font-size: 16px;
    cursor: pointer;
    width: 100%;
    transition: background 0.2s;
    font-family: inherit;
}

.btn-google:hover {
    background: var(--color-bg);
}

.btn-google:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* =============================================================================
   13. Menu Bottom-Sheet content styles (container uses .modal-overlay + .modal-sheet)
   ============================================================================= */
.menu-sheet-grip {
    width: 40px;
    height: 4px;
    background: var(--color-border);
    border-radius: 2px;
    margin: -10px auto 20px;  /* negative top offsets .modal-sheet's 24px padding → grip sits ~14px from top */
    flex-shrink: 0;
    cursor: grab;
}

.menu-sheet-divider {
    border: none;
    border-top: 1px solid var(--color-border);
    margin: 16px 0;
}

.menu-user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 0 12px;
}

.menu-avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background: var(--color-primary);
    color: var(--color-white);
    font-weight: 700;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.menu-user-email {
    font-size: 14px;
    color: var(--color-text-muted);
    word-break: break-all;
    text-decoration: none;
}

.menu-guest-label {
    font-size: 14px;
    color: var(--color-text-muted);
    padding: 8px 0 12px;
}

.menu-signin-btn {
    margin-bottom: 4px;
}

.menu-signout-btn {
    background: none;
    color: var(--color-danger);
    border: 1px solid rgba(244, 67, 54, 0.4);
    padding: 14px 20px;
    font-size: 16px;
    width: 100%;
    margin-bottom: 4px;
}

.menu-signout-btn:hover {
    background: rgba(244, 67, 54, 0.06);
}

.menu-exit-btn {
    background: none;
    color: var(--color-danger);
    border: 1px solid rgba(244, 67, 54, 0.4);
    padding: 14px 20px;
    font-size: 16px;
}

.menu-exit-btn:hover {
    background: rgba(244, 67, 54, 0.06);
}

.menu-sheet-game-section {
    padding: 4px 0 8px;
}

.menu-game-title-label {
    font-weight: 600;
    font-size: 16px;
    margin: 0 0 6px;
}

.menu-game-link-text {
    font-size: 12px;
    color: var(--color-text-muted);
    word-break: break-all;
    margin: 0 0 10px;
}

.menu-copy-btn {
    width: 100%;
    margin-bottom: 4px;
}

/* =============================================================================
   14. Recent Games (enterLinkScreen)
   ============================================================================= */
.recent-games-section  { margin-top: 28px; }
.recent-games-title    { font-size: 14px; font-weight: 600; color: var(--color-text-muted);
                         text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 12px; }
.recent-games-list     { display: flex; flex-direction: column; gap: 10px; }
.game-tile             { display: flex; align-items: center; gap: 12px;
                         background: var(--color-white); border: 1px solid var(--color-border);
                         border-radius: var(--radius-md); padding: 14px 16px; }
.game-tile-info        { flex: 1; min-width: 0; }
.game-tile-name        { font-weight: 600; font-size: 15px; color: var(--color-text);
                         white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.game-tile-status      { font-size: 12px; color: var(--color-text-muted); margin-top: 2px; }
.game-tile-status.in-progress { color: var(--color-secondary); }
.game-tile-status.completed   { color: var(--color-primary); }
.game-tile-btn         { flex-shrink: 0; padding: 8px 16px; font-size: 14px;
                         width: auto; border-radius: var(--radius-sm); }
.recent-games-empty,
.recent-games-loading  { color: var(--color-text-muted); font-size: 14px;
                         text-align: center; padding: 16px 0; }

/* Clickable game tiles (My Games) */
.game-tile-clickable   { cursor: pointer; }
.game-tile-edit-icon   { font-size: 18px; flex-shrink: 0; color: var(--color-text-muted); }

/* Share icon-button in tile */
.game-tile-share {
    background: none;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    padding: 8px 10px;
    cursor: pointer;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--color-text-muted);
}
.game-tile-share:hover { background: var(--color-bg); }

/* Delete game button styling handled in .create-controls */

/* Confirm delete modal */
.confirm-delete-text {
    text-align: center;
    font-size: 16px;
    color: var(--color-text-muted);
    margin-bottom: 24px;
    line-height: 1.5;
}

.confirm-delete-actions {
    display: flex;
    gap: 12px;
}

.confirm-delete-actions .btn {
    flex: 1;
}

.btn-danger {
    background: var(--color-danger);
    color: var(--color-white);
    border: none;
}

/* =============================================================================
   16. Fullscreen Photo Viewer
   ============================================================================= */
.photo-fullscreen {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: var(--color-black);
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.photo-fullscreen.hidden {
    display: none !important;
}

.photo-fullscreen img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    transform-origin: center center;
    will-change: transform;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
}

.photo-fullscreen-close {
    position: fixed;
    top: 16px;
    left: 16px;
    z-index: 201;
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    border: none;
    background: rgba(0, 0, 0, 0.5);
    color: var(--color-white);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
