:root {
    color-scheme: light;
    --ink: #252238;
    --muted: #767286;
    --paper: #fffdf9;
    --surface: #f1eff7;
    --accent: #6c4cff;
    --accent-dark: #5237dd;
    --border: #ded9eb;
    font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--surface); }
button, input { font: inherit; }
button { cursor: pointer; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, #ded5ff 0, transparent 35%), var(--surface); }
.login-card { width: min(100%, 470px); padding: clamp(28px, 7vw, 52px); background: var(--paper); border: 1px solid var(--border); border-radius: 28px; box-shadow: 0 24px 70px rgba(50, 39, 92, .14); }
.eyebrow { margin: 0 0 10px; color: var(--accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; font-size: 12px; }
h1 { margin: 0 0 14px; font-size: clamp(30px, 8vw, 44px); line-height: 1.05; }
.lead { color: var(--muted); line-height: 1.55; margin: 0 0 26px; }
.login-form { display: grid; gap: 18px; }
.login-form label { display: grid; gap: 7px; font-weight: 700; }
.login-form label span { color: var(--muted); font-weight: 400; font-size: 12px; }
.login-form input { width: 100%; padding: 13px 15px; border: 1px solid var(--border); border-radius: 12px; background: white; outline: none; }
.login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 76, 255, .14); }
.primary-button { border: 0; border-radius: 12px; padding: 13px 22px; color: white; background: var(--accent); font-weight: 800; }
.primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.notice { margin: 0 0 20px; padding: 13px 15px; border-radius: 12px; background: #ece8ff; line-height: 1.4; }
.notice-error { color: #9a2540; background: #ffe8ee; }

.editor-page { min-height: 100vh; }
.topbar { min-height: 68px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 12px clamp(16px, 4vw, 38px); background: var(--paper); border-bottom: 1px solid var(--border); }
.brand { font-weight: 900; margin-right: 22px; }
.welcome { color: var(--muted); }
.quiet-button, .tool, .code-banner button { padding: 9px 13px; border: 1px solid var(--border); border-radius: 10px; color: var(--ink); background: white; font-weight: 700; text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.header-actions form { margin: 0; }
.editor-notices { display: grid; gap: 10px; margin: 14px 20px 0; }
.contribution-guide { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.7fr); gap: 22px; padding: 20px; background: linear-gradient(135deg, #fffdf9, #f7f3ff); border: 1px solid #d9d0fb; border-radius: 18px; box-shadow: 0 12px 34px rgba(75, 57, 150, .08); }
.contribution-guide-intro h2 { margin: 0; font-size: clamp(21px, 2.5vw, 30px); line-height: 1.15; }
.contribution-guide-intro > p:last-child { margin: 10px 0 0; color: var(--muted); line-height: 1.5; }
.contribution-guide ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; counter-reset: contribution-step; }
.contribution-guide li { position: relative; min-width: 0; padding: 14px 14px 14px 48px; background: rgba(255, 255, 255, .82); border: 1px solid var(--border); border-radius: 14px; counter-increment: contribution-step; }
.contribution-guide li::before { position: absolute; top: 13px; left: 13px; display: grid; place-items: center; width: 25px; height: 25px; color: white; background: var(--accent); border-radius: 50%; content: counter(contribution-step); font-size: 12px; font-weight: 900; }
.contribution-guide li strong { display: block; margin-bottom: 5px; font-size: 14px; }
.contribution-guide li span { display: block; color: var(--muted); font-size: 13px; line-height: 1.4; }
.code-banner { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 24px; padding: 14px 18px; color: #352b6c; background: #e8e2ff; border: 1px solid #d6ccff; border-radius: 14px; line-height: 1.35; box-shadow: 0 10px 28px rgba(75, 57, 150, .1); }
.editor-layout { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 20px; padding: 20px; }
.toolbar { display: flex; flex-direction: column; gap: 10px; padding: 14px; background: var(--paper); border: 1px solid var(--border); border-radius: 18px; align-self: start; }
.tool { text-align: left; }
.undo-tool { display: grid; place-items: center; width: 46px; height: 46px; padding: 0; color: white; background: var(--accent); border-color: var(--accent); border-radius: 14px; font-size: 28px; line-height: 1; }
.undo-tool:hover { background: var(--accent-dark); }
.undo-tool:disabled { opacity: .45; cursor: not-allowed; }
.tool.active { color: white; border-color: var(--accent); background: var(--accent); }
.tool.danger { color: #ae2948; }
.control { display: grid; gap: 7px; padding: 8px 2px; color: var(--muted); font-size: 13px; font-weight: 700; }
.control input[type="color"] { width: 100%; height: 42px; padding: 3px; border: 1px solid var(--border); border-radius: 9px; background: white; }
.add-control { display: grid; gap: 7px; padding-top: 8px; border-top: 1px solid var(--border); }
.add-control label { color: var(--muted); font-size: 13px; font-weight: 700; }
.add-control label { display: grid; gap: 6px; }
.add-control input, .add-control select { min-width: 0; width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: white; }
.add-control select:focus, .add-control input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 76, 255, .12); }
.upload-button { display: block; text-align: center; }
.layer-controls { display: grid; gap: 7px; padding-top: 8px; border-top: 1px solid var(--border); }
.layer-controls > span { color: var(--muted); font-size: 13px; font-weight: 700; }
.layer-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.layer-button { min-width: 0; padding: 8px; text-align: center; font-size: 12px; line-height: 1.2; }
.layer-button:disabled { opacity: .42; cursor: not-allowed; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.workspace { min-width: 0; }
.canvas-shell { overflow: auto; height: min(68vh, 720px); min-height: 360px; padding: clamp(10px, 3vw, 26px); background: #d9d5e2; border-radius: 18px; overscroll-behavior: contain; }
#drawCanvas { display: block; width: min(100%, 900px); max-width: none; height: auto; margin: auto; background: white; box-shadow: 0 8px 30px rgba(44, 37, 66, .16); cursor: crosshair; touch-action: none; transform-origin: top left; }
#drawCanvas.eraser-cursor { cursor: cell; }
#drawCanvas.select-cursor { cursor: default; }
#drawCanvas.rect-select-cursor { cursor: crosshair; }
.editor-footer { display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 14px 2px 0; color: var(--muted); }
.editor-actions { display: flex; align-items: center; gap: 10px; }
.editor-actions form { margin: 0; }
.zoom-controls { display: inline-flex; align-items: center; gap: 8px; padding: 6px; color: var(--ink); background: white; border: 1px solid var(--border); border-radius: 999px; }
.zoom-controls button { min-width: 38px; height: 34px; padding: 0 10px; color: var(--ink); background: #f7f5fb; border: 1px solid var(--border); border-radius: 999px; font-weight: 900; }
.zoom-controls button:hover { color: white; background: var(--accent); border-color: var(--accent); }
.zoom-controls strong { min-width: 52px; text-align: center; font-size: 13px; }
.submit-button, .approve-button, .reject-button { border: 0; border-radius: 12px; padding: 13px 18px; color: white; font-weight: 800; }
.submit-button { background: #252238; }
.submit-button:disabled { opacity: .5; cursor: not-allowed; }
.page-notice, .drawing-status { margin: 0; padding: 12px 18px; border-radius: 12px; }
.page-notice { color: #3a316f; background: #e8e2ff; }
.drawing-status { display: flex; gap: 12px; align-items: baseline; background: white; border: 1px solid var(--border); }
.drawing-status span { color: var(--muted); }
.drawing-status.status-approved { color: #17683d; background: #e7f9ee; border-color: #bce9cf; box-shadow: 0 12px 30px rgba(33, 134, 87, .12); }
.drawing-status.status-approved span { color: #2d7d52; }
.drawing-status.status-pending { color: #7a5000; background: #fff5d9; border-color: #f2d58c; }
.drawing-status.status-rejected { color: #9a2540; background: #ffe8ee; border-color: #ffc3d0; }
.drawing-status.status-rejected span { color: #9a2540; }
.moderation-toast { position: fixed; z-index: 30; right: 22px; bottom: 22px; width: min(360px, calc(100% - 44px)); padding: 16px 18px; color: #113b25; background: #e7f9ee; border: 1px solid #bce9cf; border-radius: 18px; box-shadow: 0 20px 55px rgba(33,134,87,.22); transform: translateY(18px); opacity: 0; transition: transform .25s ease, opacity .25s ease; }
.moderation-toast.is-visible { transform: translateY(0); opacity: 1; }
.moderation-toast strong { display: block; margin-bottom: 3px; }
.moderation-toast span { display: block; color: #2d7d52; line-height: 1.35; }

.back-link { display: inline-block; margin-top: 20px; color: var(--accent); font-weight: 700; }
.admin-page { min-height: 100vh; background: var(--surface); }
.admin-container { width: min(1440px, 100%); margin: 0 auto; padding: 28px; }
.admin-title { margin: 28px 0 16px; font-size: 32px; }
.admin-main-tabs { display: flex; gap: 10px; margin-bottom: 18px; }
.admin-main-tabs a { padding: 11px 16px; color: var(--ink); background: white; border: 1px solid var(--border); border-radius: 12px; text-decoration: none; font-weight: 900; }
.admin-main-tabs a.active { color: white; border-color: var(--accent); background: var(--accent); }
.status-tabs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 5px; }
.status-tabs a { flex: 0 0 auto; padding: 9px 14px; color: var(--ink); background: white; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; font-weight: 700; }
.status-tabs a.active { color: white; border-color: var(--accent); background: var(--accent); }
.admin-collage-panel { display: flex; justify-content: space-between; align-items: center; gap: 18px; margin: 22px 0 8px; padding: 18px; background: white; border: 1px solid var(--border); border-radius: 18px; }
.admin-collage-panel h2 { margin: 0 0 5px; }
.admin-collage-panel p { margin: 0; color: var(--muted); }
.admin-collage-actions { display: flex; align-items: center; gap: 10px; }
.admin-collage-actions form { margin: 0; }
.moderation-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }
.drawing-card { overflow: hidden; background: white; border: 1px solid var(--border); border-radius: 18px; }
.drawing-card > a { display: block; padding: 12px; background: #ddd9e7; }
.drawing-card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: contain; background: white; border-radius: 10px; }
.drawing-card-body { display: grid; gap: 10px; padding: 16px; }
.drawing-meta { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.drawing-card small { color: var(--muted); }
.status-badge { padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.status-draft { background: #eceaf1; }
.status-pending { color: #7a5000; background: #fff0c7; }
.status-approved { color: #17683d; background: #dff6e9; }
.status-rejected { color: #9a2540; background: #ffe1e9; }
.moderation-comment { margin: 0; padding: 9px 11px; color: #8a2941; background: #fff0f3; border-radius: 9px; }
.moderation-form { display: grid; gap: 9px; }
.moderation-form textarea { min-height: 70px; resize: vertical; padding: 10px; border: 1px solid var(--border); border-radius: 10px; font: inherit; }
.moderation-actions { display: flex; gap: 8px; }
.moderation-actions button { flex: 1; }
.approve-button { background: #218657; }
.reject-button { background: #bd3655; }
.empty-state { padding: 24px; color: var(--muted); background: white; border-radius: 14px; }
.users-section { margin-top: 42px; }
.users-table-wrap { overflow-x: auto; background: white; border: 1px solid var(--border); border-radius: 16px; }
.users-table { width: 100%; border-collapse: collapse; }
.users-table th, .users-table td { padding: 12px 15px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.users-table th { color: var(--muted); font-size: 12px; text-transform: uppercase; }
.user-access-form { display: flex; align-items: end; gap: 8px; margin: 0; }
.user-access-form label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 700; }
.user-access-form input { width: 150px; min-height: 40px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; font: inherit; }
.user-access-form input:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(108, 76, 255, .12); }
.user-create-form { width: fit-content; margin: 0 0 14px; padding: 16px; align-items: end; background: white; border: 1px solid var(--border); border-radius: 16px; }
.reset-code { font-size: 17px; }
.verified-check { display: inline-grid; place-items: center; width: 19px; height: 19px; color: white; background: var(--accent); border-radius: 50%; font-size: 12px; vertical-align: 1px; }
.verify-button { padding: 8px 12px; color: var(--accent); background: #efebff; border: 1px solid #d7ceff; border-radius: 9px; font-weight: 800; }
.verify-button.is-verified { color: #17683d; background: #dff6e9; border-color: #bce9cf; }
.admin-games-panel { display: grid; gap: 18px; }
.admin-games-heading { display: flex; justify-content: space-between; align-items: end; gap: 18px; padding: 18px; background: white; border: 1px solid var(--border); border-radius: 18px; }
.admin-games-heading .admin-title { margin-top: 0; }
.admin-games-heading p { margin: 0; color: var(--muted); }
.admin-game-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.admin-game-card { display: grid; gap: 10px; padding: 18px; background: white; border: 1px solid var(--border); border-radius: 18px; }
.admin-game-card span { color: var(--accent); font-size: 12px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.admin-game-card h2, .admin-game-card p { margin: 0; }
.admin-game-card p { color: var(--muted); }
.admin-game-card strong { color: var(--ink); }
.admin-game-card form, .admin-games-heading form { margin: 0; }

.games-page { min-height: 100vh; color: white; background: radial-gradient(circle at 15% 0, rgba(108,76,255,.38), transparent 35%), #171426; }
.games-topbar { color: var(--ink); }
.games-container { width: min(1180px, 100%); margin: 0 auto; padding: clamp(45px, 8vw, 100px) 24px; }
.games-hero { max-width: 780px; margin-bottom: 50px; }
.games-hero h1 { margin-bottom: 18px; font-size: clamp(48px, 9vw, 92px); letter-spacing: -.05em; }
.games-hero > p:last-child { max-width: 650px; margin: 0; color: #aaa5bd; font-size: clamp(17px, 2vw, 21px); line-height: 1.55; }
.games-grid { display: grid; gap: 16px; }
.game-card { display: grid; grid-template-columns: 72px minmax(0, 1fr) auto; align-items: center; gap: 20px; padding: 24px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 20px; }
.game-card-ready { background: linear-gradient(110deg, rgba(108,76,255,.26), rgba(255,255,255,.06)); border-color: rgba(141,119,255,.45); }
.game-number { color: #8d77ff; font-size: 28px; font-weight: 900; }
.game-card h2 { margin: 0 0 6px; }
.game-card p { margin: 0; color: #918b9f; }
.game-card .game-best { margin-top: 10px; color: #ded9eb; font-weight: 900; }
.game-card button, .game-lock { padding: 9px 14px; color: #8f899d; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 999px; font-weight: 700; }
.game-start-button { padding: 11px 18px; color: white; background: var(--accent); border-radius: 999px; text-decoration: none; font-weight: 900; }
.game-complete-mark { grid-column: 2; color: #7be6ac; font-size: 13px; font-weight: 800; }

.memory-page { min-height: 100vh; color: white; background: radial-gradient(circle at 50% -20%, rgba(108,76,255,.32), transparent 42%), #151321; }
.memory-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding: 16px clamp(16px, 4vw, 48px); }
.memory-header > a { justify-self: start; color: white; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.13); }
.memory-title { display: grid; text-align: center; }
.memory-title span { color: #817a90; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.memory-title strong { font-size: 20px; }
.memory-player { justify-self: end; color: #9d97aa; font-weight: 700; }
.memory-container { width: min(920px, 100%); margin: auto; padding: 22px 16px 55px; }
.memory-status { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 20px; }
.memory-status > div { display: grid; gap: 5px; padding: 13px 16px; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.09); border-radius: 13px; }
.memory-status span { color: #827c8f; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.memory-status strong { font-size: 20px; }
.memory-board-wrap { padding: clamp(16px, 3vw, 28px); background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.09); border-radius: 24px; }
.memory-instruction { margin: 0 0 18px; color: #9d97aa; text-align: center; }
.memory-board { display: grid; grid-template-columns: repeat(var(--memory-columns), minmax(0, 1fr)); gap: clamp(7px, 1.4vw, 13px); max-width: 760px; margin: auto; }
.memory-card { position: relative; aspect-ratio: 1.45; padding: 0; overflow: hidden; color: white; background: transparent; border: 0; border-radius: clamp(10px, 2vw, 17px); transition: transform .2s ease, opacity .3s ease; }
.memory-card span { position: absolute; inset: 0; display: grid; place-items: center; border-radius: inherit; transition: opacity .18s ease, visibility .18s ease; }
.memory-card-back { color: #bcb3d1; background: linear-gradient(145deg, #37304f, #28233b); border: 1px solid rgba(255,255,255,.13); font-size: clamp(20px, 4vw, 34px); }
.memory-card-front { background: #05040a; opacity: 0; visibility: hidden; }
.memory-card-front img { display: block; width: 92%; height: 92%; object-fit: contain; image-rendering: auto; }
.memory-card.flipped .memory-card-back, .memory-card.matched .memory-card-back { opacity: 0; visibility: hidden; }
.memory-card.flipped .memory-card-front, .memory-card.matched .memory-card-front { opacity: 1; visibility: visible; }
.memory-card.matched { opacity: .5; }
.memory-card:not(.flipped):not(.matched):hover { transform: translateY(-3px); }
.memory-dialog { width: min(92vw, 470px); padding: 30px; color: var(--ink); background: var(--paper); border: 0; border-radius: 24px; box-shadow: 0 35px 100px rgba(0,0,0,.55); text-align: center; }
.memory-dialog::backdrop { background: rgba(8,7,14,.8); backdrop-filter: blur(6px); }
.memory-dialog h2 { margin: 4px 0 12px; font-size: 34px; }
.memory-dialog > p:not(.eyebrow) { color: var(--muted); line-height: 1.5; }
.nick-quiz-page { min-height: 100vh; color: white; background: radial-gradient(circle at 20% -10%, rgba(255,102,200,.22), transparent 38%), radial-gradient(circle at 80% 0, rgba(108,76,255,.34), transparent 42%), #151321; }
.nick-quiz-container { width: min(900px, 100%); margin: auto; padding: 28px 16px 70px; }
.nick-quiz-card { padding: clamp(22px, 5vw, 42px); background: rgba(255,255,255,.065); border: 1px solid rgba(255,255,255,.1); border-radius: 28px; box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.nick-quiz-topline { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 20px; color: #aaa5bd; font-weight: 800; }
.nick-quiz-card h1 { margin-bottom: 24px; font-size: clamp(42px, 8vw, 74px); letter-spacing: -.05em; }
.nick-hints { display: grid; gap: 12px; margin-bottom: 16px; }
.nick-hint { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 12px; align-items: start; padding: 14px; background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1); border-radius: 16px; }
.nick-hint span { display: grid; place-items: center; width: 38px; height: 38px; color: white; background: var(--accent); border-radius: 50%; font-weight: 900; }
.nick-hint p { margin: 7px 0 0; color: #ded9eb; line-height: 1.45; }
.nick-hint-button { margin-bottom: 22px; color: white; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); }
.nick-hint-button:disabled { opacity: .5; cursor: not-allowed; }
.nick-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.nick-option { min-height: 58px; padding: 14px 16px; color: white; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.15); border-radius: 16px; font-weight: 900; }
.nick-option:hover { border-color: rgba(255,255,255,.34); background: rgba(255,255,255,.12); }
.nick-option.is-correct { color: #10251a; background: #7be6ac; border-color: #7be6ac; }
.nick-option.is-wrong { color: white; background: #bd3655; border-color: #bd3655; }
.nick-feedback { min-height: 25px; margin: 16px 0 0; color: #cfc9db; font-weight: 800; }

.intro-page { min-height: 100vh; overflow: hidden; color: white; background: #12101e; }
.intro-glow { position: fixed; border-radius: 50%; filter: blur(10px); pointer-events: none; }
.intro-glow-one { width: 60vw; height: 60vw; top: -35vw; left: -12vw; background: radial-gradient(circle, rgba(108,76,255,.42), transparent 68%); }
.intro-glow-two { width: 50vw; height: 50vw; right: -24vw; bottom: -28vw; background: radial-gradient(circle, rgba(0,242,255,.14), transparent 68%); }
.intro-container { position: relative; z-index: 1; width: min(1180px, 100%); min-height: 100vh; margin: auto; padding: 28px clamp(22px, 6vw, 72px) 60px; }
.intro-nav { display: flex; justify-content: space-between; align-items: center; }
.intro-stage { color: #918aa4; font-size: 13px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.intro-nav form { margin: 0; }
.intro-back { padding: 9px 14px; color: #cbc7d5; background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.13); border-radius: 10px; font-weight: 700; }
.intro-content { max-width: 930px; margin: clamp(70px, 12vh, 140px) auto 0; }
.intro-content h1 { max-width: 900px; margin-bottom: 38px; font-size: clamp(48px, 8vw, 92px); line-height: .98; letter-spacing: -.055em; }
.intro-message { position: relative; padding: clamp(24px, 5vw, 46px); background: linear-gradient(120deg, rgba(255,255,255,.09), rgba(255,255,255,.035)); border: 1px solid rgba(255,255,255,.13); border-radius: 25px; box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.intro-message span { color: #8d77ff; font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.intro-message p { margin: 18px 0 0; font-size: clamp(22px, 4vw, 36px); font-weight: 700; }
.intro-hint { max-width: 650px; margin: 24px 0; color: #9d97a9; font-size: 17px; line-height: 1.55; }
.intro-start { display: inline-flex; align-items: center; gap: 24px; padding: 15px 18px 15px 24px; color: #10101a; background: white; border-radius: 999px; text-decoration: none; font-weight: 900; transition: transform .25s ease, box-shadow .25s ease; }
.intro-start strong { display: grid; place-items: center; width: 38px; height: 38px; color: white; background: var(--accent); border-radius: 50%; font-size: 20px; }
.intro-start:hover { transform: translateY(-3px); box-shadow: 0 16px 35px rgba(0,0,0,.3); }

.gallery-page { min-height: 100vh; overflow-x: hidden; background: #171426; color: white; }
.gallery-header { min-height: 210px; display: flex; justify-content: space-between; align-items: flex-start; gap: 30px; padding: clamp(28px, 6vw, 72px) clamp(20px, 7vw, 90px) 30px; background: radial-gradient(circle at 18% 0, rgba(108, 76, 255, .35), transparent 42%); }
.gallery-header h1 { max-width: 800px; margin-bottom: 12px; font-size: clamp(38px, 7vw, 82px); letter-spacing: -.04em; }
.gallery-header p:not(.eyebrow) { margin: 0; color: #aaa5bd; font-size: clamp(15px, 2vw, 19px); }
.gallery-header-actions { flex: 0 0 auto; display: flex; align-items: center; gap: 10px; }
.gallery-back, .gallery-collage-link { color: white; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
.gallery-collage-link { background: var(--accent); border-color: var(--accent); }
.gallery-main { position: relative; min-height: 620px; padding: clamp(42px, 7vh, 82px) 0 65px; }
.gallery-featured-intro, .gallery-community { width: min(1180px, calc(100% - 40px)); margin: 0 auto 24px; }
.gallery-featured-intro h2, .gallery-community h2 { margin: 0 0 10px; font-size: clamp(30px, 5vw, 54px); letter-spacing: -.035em; }
.gallery-featured-intro p:not(.eyebrow), .gallery-community p:not(.eyebrow) { max-width: 690px; margin: 0; color: #aaa5bd; line-height: 1.55; }
.gallery-viewport { overflow: hidden; padding: 18px 0 30px; cursor: grab; touch-action: pan-y; outline: none; }
.gallery-viewport:focus-visible { box-shadow: inset 0 0 0 3px var(--accent); }
.gallery-viewport.is-dragging { cursor: grabbing; user-select: none; }
.gallery-track { display: flex; width: max-content; will-change: transform; }
.gallery-group { display: flex; gap: clamp(18px, 3vw, 38px); padding-right: clamp(18px, 3vw, 38px); }
.gallery-card { flex: 0 0 auto; width: clamp(340px, 44vw, 650px); transform: rotate(-1deg); transition: transform .25s ease; }
.gallery-card:nth-child(even) { transform: rotate(1.2deg) translateY(10px); }
.gallery-card:hover { position: relative; z-index: 2; transform: rotate(0) translateY(-8px); }
.gallery-card a { display: block; color: inherit; text-decoration: none; will-change: transform; }
.gallery-motion-1 a { animation: gallery-float-one 13s ease-in-out -2s infinite alternate; }
.gallery-motion-2 a { animation: gallery-float-two 16s ease-in-out -7s infinite alternate; }
.gallery-motion-3 a { animation: gallery-float-three 12s ease-in-out -5s infinite alternate; }
.gallery-motion-4 a { animation: gallery-float-four 18s ease-in-out -11s infinite alternate; }
.gallery-image-wrap { position: relative; padding: 10px; background: #f6f3ed; border-radius: 18px; box-shadow: 0 24px 65px rgba(0,0,0,.35); }
.gallery-card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: contain; background: white; border-radius: 11px; }
.gallery-caption { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 13px 12px 0; color: #d7d2e2; }
.gallery-caption span { color: #8e899d; }
.gallery-caption strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-author { display: grid; justify-items: end; gap: 6px; min-width: 0; }
.gallery-verified { display: inline-flex; align-items: center; gap: 5px; color: #aaa2c0 !important; font-size: 11px; font-weight: 700; white-space: nowrap; }
.gallery-verified b { display: inline-grid; place-items: center; width: 17px; height: 17px; color: white; background: var(--accent); border-radius: 50%; font-size: 10px; }
.gallery-verified-overlay { position: absolute; z-index: 2; top: 22px; right: 22px; display: inline-flex; align-items: center; gap: 7px; padding: 7px 10px; color: #312a4a !important; background: rgba(255,255,255,.92); border: 1px solid rgba(108,76,255,.22); border-radius: 999px; box-shadow: 0 8px 22px rgba(28,20,57,.18); font-size: 11px; font-weight: 900; }
.gallery-verified-overlay b { display: inline-grid; place-items: center; width: 18px; height: 18px; color: white; background: var(--accent); border-radius: 50%; font-size: 10px; }
.gallery-fade { position: absolute; z-index: 3; top: 30px; bottom: 90px; width: min(10vw, 130px); pointer-events: none; }
.gallery-fade-left { left: 0; background: linear-gradient(90deg, #171426, transparent); }
.gallery-fade-right { right: 0; background: linear-gradient(-90deg, #171426, transparent); }
.gallery-hint { margin: 10px 20px 0; color: #777184; text-align: center; font-size: 13px; }
.gallery-controls { display: flex; justify-content: center; align-items: center; gap: 14px; padding: 0 20px; color: #9b95aa; font-size: 13px; }
.gallery-controls button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; color: white; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.18); border-radius: 50%; font-size: 24px; }
.gallery-controls button:hover { background: var(--accent); }
.gallery-empty { width: min(620px, calc(100% - 40px)); margin: 40px auto; padding: 50px 25px; text-align: center; background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 24px; }
.gallery-empty strong { font-size: 26px; }
.gallery-empty p { color: #aaa5bd; }
.gallery-community { margin-top: clamp(58px, 8vw, 94px); padding: clamp(20px, 4vw, 34px); background: linear-gradient(145deg, rgba(255,255,255,.08), rgba(255,255,255,.035)); border: 1px solid rgba(255,255,255,.1); border-radius: 28px; }
.gallery-community-heading { margin-bottom: 24px; }
.gallery-wall { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 18px; }
.gallery-wall-card { overflow: hidden; background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.12); border-radius: 20px; transition: transform .22s ease, border-color .22s ease, background .22s ease; }
.gallery-wall-card:hover { transform: translateY(-5px); border-color: rgba(255,255,255,.28); background: rgba(255,255,255,.12); }
.gallery-wall-card a { display: grid; gap: 12px; padding: 10px; color: inherit; text-decoration: none; }
.gallery-wall-card img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: contain; background: white; border-radius: 13px; }
.gallery-wall-card span { display: flex; justify-content: space-between; gap: 10px; padding: 0 4px 4px; color: #aaa5bd; font-size: 13px; }
.gallery-wall-card strong { color: white; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gallery-dialog { width: min(94vw, 1100px); max-height: 94vh; padding: 18px; color: white; background: #211d31; border: 1px solid rgba(255,255,255,.16); border-radius: 22px; box-shadow: 0 35px 100px rgba(0,0,0,.65); }
.gallery-dialog::backdrop { background: rgba(10,8,17,.82); backdrop-filter: blur(8px); }
.gallery-dialog img { display: block; max-width: 100%; max-height: 78vh; margin: auto; object-fit: contain; border-radius: 13px; background: white; }
.gallery-dialog p { margin: 14px 48px 0 4px; color: #aaa5bd; }
.gallery-dialog p strong { color: white; }
.gallery-dialog-close { position: absolute; z-index: 1; top: 28px; right: 28px; display: grid; place-items: center; width: 42px; height: 42px; padding: 0; color: white; background: rgba(23,20,38,.82); border: 1px solid rgba(255,255,255,.25); border-radius: 50%; font-size: 28px; }
.collage-page { min-height: 100vh; color: white; background: #171426; }
.collage-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; padding: clamp(28px, 6vw, 72px) clamp(20px, 7vw, 90px) 26px; background: radial-gradient(circle at 20% 0, rgba(108,76,255,.35), transparent 42%); }
.collage-header h1 { margin: 0 0 12px; font-size: clamp(40px, 7vw, 82px); letter-spacing: -.04em; }
.collage-header p:not(.eyebrow) { margin: 0; color: #aaa5bd; font-size: clamp(15px, 2vw, 19px); }
.collage-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.collage-actions .quiet-button { color: white; background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
.collage-actions .primary-button { text-decoration: none; }
.collage-main { width: min(1500px, 100%); margin: 0 auto; padding: 24px clamp(16px, 4vw, 42px) 70px; }
.collage-frame { overflow: auto; padding: clamp(14px, 3vw, 26px); background: rgba(255,255,255,.06); border: 1px solid rgba(255,255,255,.1); border-radius: 24px; box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.collage-frame img { display: block; max-width: none; width: min(100%, 1200px); height: auto; margin: auto; background: #171426; border-radius: 16px; box-shadow: 0 24px 70px rgba(0,0,0,.34); }
.collage-save-hint { margin: 16px 0 0; color: #aaa5bd; text-align: center; }
@keyframes gallery-float-one {
    from { transform: translate3d(-10px, -4px, 0); }
    to { transform: translate3d(16px, 6px, 0); }
}
@keyframes gallery-float-two {
    from { transform: translate3d(14px, 7px, 0); }
    to { transform: translate3d(-18px, -4px, 0); }
}
@keyframes gallery-float-three {
    from { transform: translate3d(-16px, 4px, 0); }
    to { transform: translate3d(12px, -6px, 0); }
}
@keyframes gallery-float-four {
    from { transform: translate3d(18px, -3px, 0); }
    to { transform: translate3d(-12px, 7px, 0); }
}

@media (max-width: 720px) {
    .topbar { min-height: 58px; }
    .brand { display: block; margin: 0; }
    .welcome { font-size: 13px; }
    .editor-notices { margin: 10px 10px 0; }
    .contribution-guide { grid-template-columns: 1fr; gap: 16px; padding: 16px; }
    .contribution-guide ol { grid-template-columns: 1fr; }
    .code-banner { align-items: stretch; flex-direction: column; gap: 10px; }
    .editor-layout { display: flex; flex-direction: column; padding: 10px; gap: 10px; }
    .toolbar { position: sticky; z-index: 2; top: 0; flex-direction: row; overflow-x: auto; align-items: center; border-radius: 14px; }
    .tool { flex: 0 0 auto; }
    .control { flex: 0 0 118px; }
    .control input[type="color"] { width: 52px; }
    .add-control { grid-template-columns: 170px 190px auto; align-items: end; flex: 0 0 480px; padding: 0 0 0 10px; border-top: 0; border-left: 1px solid var(--border); }
    .upload-button { flex: 0 0 auto; }
    .layer-controls { grid-template-columns: auto auto; align-items: center; flex: 0 0 auto; padding: 0 0 0 10px; border-top: 0; border-left: 1px solid var(--border); }
    .layer-buttons { display: flex; }
    .layer-button { flex: 0 0 auto; }
    .canvas-shell { height: 56vh; min-height: 320px; padding: 8px; border-radius: 12px; }
    .editor-footer { position: sticky; bottom: 0; padding: 10px; background: rgba(241, 239, 247, .94); }
    .editor-footer span { font-size: 12px; }
    .editor-footer { flex-wrap: wrap; }
    .zoom-controls { order: 3; width: 100%; justify-content: center; }
    .editor-actions { flex-direction: column; align-items: stretch; }
    .editor-actions button { width: 174px; }
    .drawing-status { align-items: flex-start; flex-direction: column; }
    .moderation-toast { right: 12px; bottom: 12px; width: calc(100% - 24px); }
    .admin-container { padding: 16px; }
    .admin-collage-panel { align-items: stretch; flex-direction: column; }
    .admin-collage-actions { align-items: stretch; flex-direction: column; }
    .admin-collage-actions .primary-button, .admin-collage-actions .quiet-button { text-align: center; }
    .user-create-form { width: 100%; align-items: stretch; flex-direction: column; }
    .user-create-form label, .user-create-form input, .user-create-form .primary-button { width: 100%; }
    .moderation-grid { grid-template-columns: 1fr; }
    .game-card { grid-template-columns: 48px 1fr; padding: 18px; }
    .game-card button, .game-lock { grid-column: 2; justify-self: start; }
    .game-start-button { grid-column: 2; justify-self: start; }
    .memory-header { grid-template-columns: auto 1fr; }
    .memory-title { text-align: right; }
    .memory-player { display: none; }
    .memory-status { grid-template-columns: repeat(2, 1fr); }
    .memory-status > div { padding: 10px 12px; }
    .memory-board-wrap { padding: 12px; border-radius: 17px; }
    .nick-options { grid-template-columns: 1fr; }
    .nick-quiz-topline { flex-direction: column; }
    .intro-container { padding-top: 20px; }
    .intro-content { margin-top: 65px; }
    .intro-content h1 { margin-bottom: 28px; font-size: 49px; }
    .intro-message { border-radius: 19px; }
    .intro-hint { font-size: 15px; }
    .header-actions .quiet-button { padding: 8px 10px; }
    .gallery-header, .collage-header { min-height: 180px; align-items: flex-start; flex-direction: column-reverse; gap: 24px; }
    .gallery-header h1 { font-size: 44px; }
    .gallery-header-actions, .collage-actions { width: 100%; align-items: stretch; flex-direction: column; }
    .gallery-header-actions a, .collage-actions a { text-align: center; }
    .gallery-main { padding-top: 58px; }
    .gallery-featured-intro, .gallery-community { width: calc(100% - 24px); }
    .gallery-card { width: 88vw; }
    .gallery-caption { font-size: 14px; }
    .gallery-controls span { max-width: 150px; text-align: center; }
    .gallery-wall { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card { transform: none !important; }
    .gallery-card a { animation: none; }
}
