:root {
    --primary-color: #4a90e2;
    --primary-strong: #3158d9;
    --bg-color: #edf4ff;
    --bg-tint: #f9fbff;
    --text-color: #18253d;
    --muted-text: #6e7e98;
    --cube-bg: linear-gradient(180deg, #ffffff 0%, #eef4ff 100%);
    --cube-shadow: #d1d9e6;
    --cube-depth: #bcc8db;
    --correct-color: #4caf50;
    --misplaced-color: #ffc107;
    --wrong-color: #f44336;
    --drag-over-color: #e3f2fd;
    --panel-dark: #12203a;
    --panel-mid: #1b2f53;
    --panel-soft: #f7faff;
    --accent-gold: #ffbf2f;
    --accent-violet: #7c3aed;
    --accent-coral: #ff7a59;
    --shadow-soft: 0 18px 50px rgba(23, 43, 77, 0.12);
}

body[data-theme="dark"] {
    --primary-color: #78b8ff;
    --primary-strong: #5e85ff;
    --bg-color: #0b1220;
    --bg-tint: #121b30;
    --text-color: #edf4ff;
    --muted-text: #97a8c8;
    --cube-bg: linear-gradient(180deg, #233556 0%, #18253e 100%);
    --cube-shadow: #324360;
    --cube-depth: #10192b;
    --drag-over-color: rgba(120, 184, 255, 0.16);
    --panel-soft: #16233a;
    --shadow-soft: 0 28px 80px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Plus Jakarta Sans', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    background-color: var(--bg-color);
    background-image:
        radial-gradient(circle at 20% 20%, rgba(74, 144, 226, 0.12), transparent 24%),
        radial-gradient(circle at 80% 10%, rgba(124, 58, 237, 0.10), transparent 22%),
        radial-gradient(circle at 50% 100%, rgba(255, 191, 47, 0.08), transparent 28%),
        linear-gradient(180deg, rgba(255,255,255,0.65), rgba(240,246,255,0.95)),
        url("data:image/svg+xml,%3Csvg width='72' height='72' viewBox='0 0 72 72' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%234a90e2' fill-opacity='0.05'%3E%3Cpath d='M43 41v-6h-2v6h-6v2h6v6h2v-6h6v-2h-6zM43 5V0h-2v5h-5v2h5v5h2V7h5V5h-5zM7 41v-6H5v6H0v2h5v6h2v-6h6v-2H7zM7 5V0H5v5H0v2h5v5h2V7h6V5H7z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 40px 20px;
    color: var(--text-color);
}

body[data-theme="dark"] {
    background-image:
        radial-gradient(circle at 20% 20%, rgba(94, 133, 255, 0.18), transparent 24%),
        radial-gradient(circle at 80% 10%, rgba(124, 58, 237, 0.18), transparent 22%),
        radial-gradient(circle at 50% 100%, rgba(33, 199, 242, 0.10), transparent 28%),
        linear-gradient(180deg, rgba(10, 17, 31, 0.96), rgba(12, 18, 32, 1)),
        url("data:image/svg+xml,%3Csvg width='72' height='72' viewBox='0 0 72 72' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2378b8ff' fill-opacity='0.05'%3E%3Cpath d='M43 41v-6h-2v6h-6v2h6v6h2v-6h6v-2h-6zM43 5V0h-2v5h-5v2h5v5h2V7h5V5h-5zM7 41v-6H5v6H0v2h5v6h2v-6h6v-2H7zM7 5V0H5v5H0v2h5v5h2V7h6V5H7z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}

#game-container {
    width: 100%;
    max-width: 540px;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.98), rgba(247,250,255,0.96));
    backdrop-filter: blur(12px);
    padding: 26px;
    border-radius: 34px;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    gap: 22px;
    user-select: none;
    -webkit-user-select: none;
    border: 1px solid rgba(100, 131, 185, 0.18);
    position: relative;
    overflow: visible;
}

#game-container::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at top left, rgba(74, 144, 226, 0.10), transparent 26%),
        radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.08), transparent 24%);
    pointer-events: none;
    border-radius: 34px;
    z-index: 0;
}

body[data-theme="dark"] #game-container {
    background: linear-gradient(180deg, rgba(18, 27, 46, 0.98), rgba(11, 18, 31, 0.98));
    border-color: rgba(120, 147, 191, 0.18);
}

body[data-theme="dark"] #game-container::before {
    background:
        radial-gradient(circle at top left, rgba(94, 133, 255, 0.14), transparent 26%),
        radial-gradient(circle at bottom right, rgba(124, 58, 237, 0.12), transparent 24%);
}

#game-brand {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 4px 2px 18px;
    border-bottom: 1px solid rgba(115, 136, 170, 0.18);
    margin-bottom: 2px;
    position: relative;
    z-index: 1;
}

#brand-copy {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

#brand-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

#auth-container {
    display: flex;
    align-items: center;
}

#game-logo {
    width: 60px;
    height: 60px;
    object-fit: contain;
    filter: drop-shadow(0 10px 22px rgba(58, 103, 195, 0.18));
    border-radius: 18px;
}

#game-title {
    font-size: 1.78rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, #3768d9, #56a6ff 48%, #7c3aed 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin: 0;
    line-height: 0.92;
}

#game-subtitle {
    font-size: 0.74rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: none;
    color: #7185a6;
    margin-top: 7px;
    max-width: 320px;
    line-height: 1.35;
}

.top-action-btn {
    border: none;
    background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(241,246,255,0.96));
    color: #223556;
    border-radius: 20px;
    padding: 14px 18px;
    font-size: 0.94rem;
    font-weight: 800;
    cursor: pointer;
    border: 1px solid rgba(134, 158, 196, 0.20);
    box-shadow: 0 10px 24px rgba(27, 47, 83, 0.10);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s, border-color 0.2s;
}

.icon-action-btn {
    width: 46px;
    min-width: 46px;
    height: 46px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.top-action-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.01);
    border-color: rgba(82, 123, 193, 0.34);
    box-shadow: 0 14px 28px rgba(27, 47, 83, 0.14);
}

body[data-theme="dark"] .top-action-btn {
    background: linear-gradient(135deg, #223b67, #182b4c);
    color: white;
    border-color: rgba(120, 147, 191, 0.16);
    box-shadow: 0 12px 28px rgba(27, 47, 83, 0.18);
}

body[data-theme="dark"] .top-action-btn:hover {
    filter: brightness(1.06);
    border-color: rgba(120, 147, 191, 0.28);
    box-shadow: 0 14px 28px rgba(27, 47, 83, 0.22);
}

header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 20px;
    padding: 10px 2px 8px;
    position: relative;
    z-index: 1;
}

#category-display {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

#level-indicator {
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    opacity: 0.78;
    color: #7b8ca5;
}

#category-name {
    font-weight: 700;
    font-size: 1.34rem;
    color: #1f2c44;
    text-wrap: balance;
    line-height: 1.18;
}

body[data-theme="dark"] #category-name {
    color: #f4f8ff;
}

#level-progress {
    text-align: right;
    width: 162px;
    background: rgba(255,255,255,0.72);
    border: 1px solid rgba(120, 142, 177, 0.14);
    border-radius: 20px;
    padding: 12px 14px 11px;
    box-shadow: 0 12px 30px rgba(38, 67, 118, 0.06);
}

body[data-theme="dark"] #level-progress {
    background: rgba(23, 35, 58, 0.85);
    border-color: rgba(122, 150, 204, 0.14);
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.22);
}

#progress-text, #score-display {
    font-size: 0.82rem;
    font-weight: 700;
    margin-bottom: 5px;
}

#score-display {
    color: var(--primary-color);
}

#progress-bar-container {
    height: 10px;
    background: rgba(217, 225, 239, 0.9);
    border-radius: 5px;
    overflow: hidden;
    box-shadow: inset 0 1px 4px rgba(0,0,0,0.06);
}

#progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #4a90e2, #5fb8ff, #7c3aed);
    width: 0%;
    transition: width 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#icon-container {
    display: flex;
    justify-content: center;
    padding: 28px 20px 78px;
    background:
        radial-gradient(circle at 50% 18%, rgba(255,255,255,0.98) 0%, rgba(244,248,255,0.94) 54%, rgba(237,244,255,0.95) 100%);
    border-radius: 28px;
    min-height: 230px;
    align-items: center;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.9),
        0 18px 40px rgba(27, 47, 83, 0.08);
    position: relative;
    overflow: hidden;
}

body[data-theme="dark"] #icon-container {
    background:
        radial-gradient(circle at 50% 18%, rgba(30, 41, 68, 0.98) 0%, rgba(20, 31, 52, 0.96) 54%, rgba(15, 24, 41, 0.98) 100%);
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.04),
        0 22px 48px rgba(0, 0, 0, 0.28);
}

#icon-container::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 22% 18%, rgba(74, 144, 226, 0.14), transparent 16%),
        radial-gradient(circle at 80% 28%, rgba(124, 58, 237, 0.10), transparent 18%);
    pointer-events: none;
}

.stage-kicker {
    position: absolute;
    top: 18px;
    left: 20px;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.20em;
    text-transform: uppercase;
    color: #7d8eaa;
}

#hint-btn, #skip-btn {
    position: absolute;
    bottom: 16px;
    padding: 8px 12px;
    background: rgba(255,255,255,0.96);
    border: 1px solid rgba(161, 184, 224, 0.18);
    border-radius: 999px;
    box-shadow: 0 6px 14px rgba(30, 53, 95, 0.05);
    cursor: pointer;
    font-weight: 600;
    font-size: 0.82rem;
    transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #18253d;
}

body[data-theme="dark"] #hint-btn,
body[data-theme="dark"] #skip-btn {
    background: rgba(20, 32, 54, 0.88);
    border-color: rgba(132, 162, 214, 0.14);
    color: #eef4ff;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
}

.tool-icon {
    width: 14px;
    height: 14px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    color: #5f7fcb;
    font-size: 0.62rem;
    font-weight: 700;
    box-shadow: none;
}

body[data-theme="dark"] .tool-icon {
    background: transparent;
    color: #8eb4ff;
}

.tool-label {
    line-height: 1;
    letter-spacing: 0.01em;
}

#hint-btn { right: 10px; }
#skip-btn { left: 10px; }

#hint-btn:active, #skip-btn:active {
    transform: translateY(1px);
    box-shadow: 0 6px 16px rgba(30, 53, 95, 0.12);
}

#hint-btn:hover, #skip-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(74, 144, 226, 0.26);
}

#hint-btn:disabled, #skip-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    filter: grayscale(1);
}

.tool-badge {
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.68rem;
    font-weight: 700;
    background: #ffc94a;
    color: #5a3a00;
    box-shadow: none;
}

#current-icon {
    max-width: 172px;
    max-height: 172px;
    object-fit: contain;
    filter: drop-shadow(0 16px 28px rgba(39, 58, 92, 0.18));
    position: relative;
    z-index: 1;
}

#answer-container {
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: nowrap;
    min-height: 96px;
    padding: 20px 8px 12px;
    width: 100%;
    position: relative;
    z-index: 1;
    overflow: visible;
}

.play-hint {
    text-align: center;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #7f8ea7;
    margin-top: 4px;
    line-height: 1.45;
}

.answer-slot {
    width: clamp(54px, 11vw, 62px);
    height: clamp(54px, 11vw, 62px);
    flex: 0 0 auto;
    aspect-ratio: 1 / 1;
    border: 2px solid #dbe6f3;
    background: linear-gradient(180deg, #ffffff, #f2f7ff);
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.6rem;
    font-weight: 800;
    text-transform: uppercase;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8);
}

body[data-theme="dark"] .answer-slot {
    border-color: rgba(122, 150, 204, 0.20);
    background: linear-gradient(180deg, #1a2842, #152137);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.answer-slot.drag-over {
    border-color: var(--primary-color);
    background-color: var(--drag-over-color);
    transform: scale(1.1) translateY(-5px);
    border-style: dashed;
}

.answer-slot.selected {
    border-color: var(--primary-color);
    background-color: #fff;
    box-shadow: 0 0 0 4px rgba(74, 144, 226, 0.08), 0 10px 22px rgba(74, 144, 226, 0.16);
    border-width: 3px;
    transform: translateY(-2px);
}

/* Volumetric (3D) Look for filled slots and cubes */
.answer-slot.filled, .letter-cube {
    background: var(--cube-bg);
    border: none;
    box-shadow: 
        0 4px 0 var(--cube-depth),
        0 12px 22px rgba(39, 58, 92, 0.12);
    transform: translateY(-4px) rotate(var(--rand-rot, 0deg));
    font-size: clamp(1rem, 5vw, 1.6rem);
}

.answer-slot.filled {
    cursor: pointer;
    color: white;
}

/* Feedback Colors */
.answer-slot.status-correct {
    background: var(--correct-color);
    box-shadow: 0 4px 0 #388e3c, 0 8px 15px rgba(76, 175, 80, 0.3);
}

.answer-slot.status-misplaced {
    background: var(--misplaced-color);
    box-shadow: 0 4px 0 #f57f17, 0 8px 15px rgba(255, 193, 7, 0.3);
}

.answer-slot.status-wrong {
    background: var(--wrong-color);
    box-shadow: 0 4px 0 #c62828, 0 8px 15px rgba(244, 67, 54, 0.3);
}

.answer-slot.is-hint {
    opacity: 0.6;
    border-style: solid;
    background: #fdfdfd;
    color: #aaa;
    pointer-events: none;
    box-shadow: 0 2px 0 #eee;
    transform: none;
}

#letter-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 20px 18px 10px;
    justify-content: center;
    align-content: center;
    min-height: 190px;
    transition: background-color 0.3s;
    perspective: 1000px;
    position: relative;
    background:
        linear-gradient(180deg, rgba(255,255,255,0.35), rgba(240,246,255,0.2));
    border-radius: 24px;
    border: 1px dashed rgba(108, 131, 170, 0.18);
    overflow: visible;
}

body[data-theme="dark"] #letter-pool {
    background: linear-gradient(180deg, rgba(18, 29, 48, 0.55), rgba(13, 22, 38, 0.36));
    border-color: rgba(122, 150, 204, 0.16);
}

#letter-pool.drag-over {
    background-color: var(--drag-over-color);
    border-radius: 15px;
}

.letter-cube {
    width: 58px;
    height: 58px;
    border-radius: 18px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.4rem;
    font-weight: 800;
    cursor: grab;
    user-select: none;
    text-transform: uppercase;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.2s, opacity 0.3s;
    background: var(--cube-bg);
    box-shadow:
        0 6px 0 var(--cube-depth),
        0 14px 28px rgba(39, 58, 92, 0.14);
    transform: 
        rotate(var(--rand-rot, 0deg)) 
        translate(var(--rand-x, 0px), var(--rand-y, 0px));
    position: relative;
    z-index: 1;
}

.letter-cube:hover {
    z-index: 10;
    transform: 
        translateY(-8px) 
        rotate(calc(var(--rand-rot, 0deg) * 1.5)) 
        scale(1.1);
    box-shadow: 0 12px 0 var(--cube-depth), 0 18px 34px rgba(0,0,0,0.18);
}

.letter-cube:active {
    transform: translateY(0) rotate(0deg) scale(0.95);
    box-shadow: 0 2px 0 var(--cube-depth), 0 4px 8px rgba(0,0,0,0.1);
    cursor: grabbing;
}

.letter-cube.dragging {
    opacity: 0.3;
    transform: scale(0.8);
}

.dragging-ghost {
    opacity: 0.9;
    pointer-events: none;
    transition: none !important;
    box-shadow: 0 15px 35px rgba(0,0,0,0.4) !important;
    z-index: 2000;
}

.letter-cube.used {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    transform: scale(0.5);
}

.letter-cube.confirmed-wrong {
    background: #ffebee;
    color: var(--wrong-color);
    box-shadow: 0 4px 0 #ef9a9a;
    opacity: 0.6;
}

.letter-cube.confirmed-misplaced {
    background: var(--misplaced-color);
    color: white;
    box-shadow: 0 4px 0 #f57f17;
}

.letter-cube.confirmed-correct {
    background: var(--correct-color);
    color: white;
    box-shadow: 0 4px 0 #388e3c;
}

/* Modal Improvements */
#message-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
}

#message-content {
    background: white;
    padding: 35px;
    border-radius: 35px;
    box-shadow: 0 25px 60px rgba(0,0,0,0.2);
    text-align: center;
    width: 90%;
    max-width: 420px;
    border: 6px solid var(--primary-color);
    transform: scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

body[data-theme="dark"] #message-container {
    background: rgba(3, 8, 18, 0.68);
}

body[data-theme="dark"] #message-content {
    background: linear-gradient(180deg, rgba(16, 26, 44, 0.98), rgba(12, 20, 35, 0.98));
    border-color: rgba(98, 143, 255, 0.42);
    box-shadow: 0 26px 70px rgba(0, 0, 0, 0.42);
}

#message-container.hidden {
    opacity: 0;
    pointer-events: none;
}

#message-container.hidden #message-content {
    transform: scale(0.7) translateY(40px);
}

#message-text {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--primary-color);
    margin-bottom: 10px;
}

body[data-theme="dark"] #message-text {
    color: #eef4ff;
}

#message-details {
    margin-bottom: 25px;
    color: #666;
    line-height: 1.5;
}

body[data-theme="dark"] #message-details {
    color: #9eb1cf;
}

#message-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.modal-btn {
    padding: 12px 25px;
    border: none;
    border-radius: 18px;
    font-size: 1rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s;
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 0 #3a76bb;
}

.modal-btn.secondary {
    background: #edf2f7;
    color: #4a5568;
    box-shadow: 0 4px 0 #cbd5e0;
}

.modal-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.05);
}

.modal-btn:active {
    transform: translateY(2px);
    box-shadow: none;
}


footer {
    margin-top: 10px;
    text-align: center;
    font-size: 0.74rem;
    color: #7b8ca6;
    border-top: 1px solid rgba(115, 136, 170, 0.18);
    padding-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    position: relative;
    z-index: 1;
}

body[data-theme="dark"] footer {
    color: #8ea2c4;
    border-top-color: rgba(122, 150, 204, 0.14);
}

footer a {
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 600;
}

footer a:hover {
    text-decoration: underline;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

.footer-link {
    border: none;
    background: transparent;
    color: #7f8da4;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    cursor: pointer;
}

.footer-link:hover {
    color: var(--primary-color);
}

.footer-meta {
    color: #95a3b8;
    font-size: 0.68rem;
    font-weight: 500;
    line-height: 1.55;
}

body[data-theme="dark"] .footer-meta,
body[data-theme="dark"] .footer-link {
    color: #8ea2c4;
}

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(8, 15, 29, 0.68);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    z-index: 2200;
}

.overlay.hidden {
    display: none;
}

.sheet-modal,
.payment-modal,
.legal-modal {
    width: min(100%, 760px);
    max-height: min(88vh, 900px);
    overflow-y: auto;
    background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(245,248,252,0.98));
    border-radius: 34px;
    padding: 32px;
    box-shadow: 0 30px 80px rgba(0,0,0,0.24);
    position: relative;
}

body[data-theme="dark"] .sheet-modal,
body[data-theme="dark"] .payment-modal,
body[data-theme="dark"] .legal-modal {
    background: linear-gradient(180deg, rgba(14, 23, 39, 0.98), rgba(10, 17, 30, 0.98));
    border: 1px solid rgba(100, 130, 190, 0.18);
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.46);
}

.payment-modal {
    width: min(100%, 520px);
    text-align: center;
}

.legal-modal {
    width: min(100%, 640px);
}

.close-btn {
    position: absolute;
    top: 18px;
    right: 18px;
    border: none;
    background: transparent;
    color: #1f2937;
    width: 28px;
    height: 28px;
    border-radius: 0;
    padding: 0;
    font-size: 1.9rem;
    line-height: 0.8;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

body[data-theme="dark"] .close-btn {
    color: #dbe7ff;
}

.close-btn:hover {
    background: transparent;
    opacity: 0.72;
}

.modal-kicker,
.store-label {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.34em;
    font-weight: 900;
    color: #8494ac;
}

body[data-theme="dark"] .modal-kicker,
body[data-theme="dark"] .store-label {
    color: #8ea6cb;
}

.modal-title {
    font-size: clamp(2.5rem, 8vw, 4rem);
    font-style: italic;
    font-weight: 900;
    color: #13203a;
    margin: 6px 0 14px;
}

body[data-theme="dark"] .modal-title {
    color: #f4f8ff;
}

.modal-copy {
    color: #61758f;
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 22px;
}

body[data-theme="dark"] .modal-copy {
    color: #9db0cc;
}

.store-grid {
    display: grid;
    gap: 16px;
}

.store-card {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    padding: 24px 24px 22px;
    border-radius: 28px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.08), rgba(255,255,255,0.94));
    border: 1px solid rgba(74, 144, 226, 0.18);
}

body[data-theme="dark"] .store-card {
    background: linear-gradient(135deg, rgba(36, 55, 85, 0.68), rgba(18, 28, 46, 0.92));
    border-color: rgba(96, 129, 190, 0.18);
}

.store-card.featured {
    background: linear-gradient(135deg, rgba(124, 58, 237, 0.12), rgba(74, 144, 226, 0.10), rgba(255,255,255,0.98));
}

body[data-theme="dark"] .store-card.featured {
    background: linear-gradient(135deg, rgba(86, 50, 168, 0.28), rgba(34, 66, 120, 0.32), rgba(18, 28, 46, 0.96));
}

.store-card h3 {
    font-size: 2rem;
    line-height: 1.05;
    margin: 10px 0 10px;
    color: #12203a;
}

body[data-theme="dark"] .store-card h3 {
    color: #f3f7ff;
}

.store-card p {
    color: #66788f;
    line-height: 1.6;
}

body[data-theme="dark"] .store-card p {
    color: #9fb0c8;
}

.store-side {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    justify-content: space-between;
    min-width: 132px;
}

.store-side strong {
    font-size: 2.1rem;
    color: var(--accent-gold);
    font-weight: 900;
}

.store-pay-btn,
#discount-apply-btn,
#payment-soon-btn,
#payment-close-btn {
    border: none;
    border-radius: 22px;
    padding: 16px 24px;
    font-size: 1rem;
    font-weight: 900;
    cursor: pointer;
}

.store-pay-btn,
#discount-apply-btn,
#payment-soon-btn {
    color: white;
    background: linear-gradient(135deg, #21c7f2, #4a90e2, #7c3aed);
    box-shadow: 0 16px 28px rgba(74, 144, 226, 0.18);
}

#payment-close-btn {
    background: #edf2f7;
    color: #2d3748;
}

.discount-box {
    margin-top: 18px;
    border-radius: 28px;
    border: 1px solid rgba(74, 144, 226, 0.18);
    background: #f8fbff;
    padding: 20px;
}

body[data-theme="dark"] .discount-box {
    border-color: rgba(96, 129, 190, 0.18);
    background: rgba(17, 28, 47, 0.92);
}

.discount-row {
    display: flex;
    gap: 12px;
    margin: 12px 0 10px;
}

.discount-row input {
    flex: 1;
    border: 1px solid rgba(27, 47, 83, 0.16);
    border-radius: 18px;
    padding: 16px 18px;
    font-size: 1rem;
    font-weight: 800;
    color: #1f2937;
}

body[data-theme="dark"] .discount-row input {
    background: rgba(10, 17, 30, 0.92);
    border-color: rgba(100, 130, 190, 0.18);
    color: #eef4ff;
}

#discount-status {
    font-size: 0.88rem;
    color: #6b7c93;
    line-height: 1.5;
}

body[data-theme="dark"] #discount-status {
    color: #8ea4c6;
}

.payment-mark {
    width: 84px;
    height: 84px;
    border-radius: 26px;
    margin: 0 auto 18px;
    display: grid;
    place-items: center;
    color: white;
    font-size: 2.25rem;
    font-weight: 900;
    background: linear-gradient(135deg, #21c7f2, #4a90e2, #7c3aed);
}

#payment-title {
    font-size: 2.8rem;
    font-style: italic;
    font-weight: 900;
    color: #14213a;
    margin-bottom: 14px;
}

body[data-theme="dark"] #payment-title,
body[data-theme="dark"] #legal-title {
    color: #f4f8ff;
}

#payment-copy,
#legal-body {
    color: #61758f;
    line-height: 1.8;
    font-size: 1rem;
}

body[data-theme="dark"] #payment-copy,
body[data-theme="dark"] #legal-body {
    color: #9db0cc;
}

.payment-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    margin-top: 24px;
}

#legal-title {
    font-size: 2rem;
    font-weight: 900;
    color: #14213a;
    margin-bottom: 18px;
}

@media (max-width: 680px) {
    body {
        background: #fff;
        align-items: flex-start;
        padding: 0; /* Reset body padding for mobile */
    }
    
    #game-container {
        max-width: 100%;
        border-radius: 0;
        box-shadow: none;
        border: none;
        min-height: 100vh;
        padding: 15px;
        gap: 15px;
        justify-content: space-between; /* Spread content and push footer down */
    }

    #game-brand {
        align-items: flex-start;
        gap: 12px;
    }

    #brand-copy {
        align-items: flex-start;
        flex: 1;
    }

    #brand-actions {
        flex-direction: row;
        align-items: flex-start;
        justify-content: flex-end;
        flex-wrap: wrap;
        gap: 8px;
        max-width: 118px;
    }

    #game-title {
        font-size: 1.34rem;
    }

    #game-subtitle {
        font-size: 0.57rem;
        letter-spacing: 0.04em;
        max-width: 150px;
        line-height: 1.3;
    }

    header {
        align-items: stretch;
        flex-direction: column;
        gap: 12px;
    }

    #level-progress {
        width: 100%;
        text-align: left;
    }

    #icon-container {
        min-height: 190px;
        padding: 22px 12px 74px;
    }

    #current-icon {
        max-width: 140px;
        max-height: 140px;
    }

    .letter-cube {
        width: 48px;
        height: 48px;
        font-size: 1.2rem;
        border-radius: 12px;
    }

    .answer-slot {
        width: 48px;
        height: 48px;
        font-size: 1.32rem;
        border-radius: 14px;
    }

    .play-hint {
        font-size: 0.56rem;
        letter-spacing: 0.07em;
        padding: 0 10px;
        line-height: 1.45;
    }

    #message-content {
        padding: 25px;
        border-radius: 25px;
    }

    #message-text {
        font-size: 1.8rem;
    }

    .sheet-modal,
    .payment-modal,
    .legal-modal {
        padding: 24px 18px;
        border-radius: 28px;
    }

    .store-card {
        flex-direction: column;
    }

    .store-side {
        align-items: flex-start;
        min-width: 0;
        gap: 14px;
    }

    .discount-row,
    .payment-actions {
        flex-direction: column;
    }

    .discount-row input,
    #discount-apply-btn,
    .payment-actions button {
        width: 100%;
    }

    #discount-apply-btn,
    .payment-actions button {
        min-width: 0;
    }

    .discount-box {
        padding: 18px;
    }

    #discount-status {
        line-height: 1.6;
    }

    .close-btn {
        top: 14px;
        right: 14px;
        width: 26px;
        height: 26px;
        font-size: 1.7rem;
    }
}
