/* ============================================================
   Gamer Portfolio -- "The Stack"
   Full-viewport canvas game with a DOM HUD on top.
   ============================================================ */

body.theme-gamer { overflow: hidden; }
#view-gamer { overflow: hidden; }

.game-stage {
    position: relative;
    width: 100%;
    height: 100vh;
    overflow: hidden;
    background: #05070f;
    font-family: var(--font-display), 'Inter', sans-serif;
    color: #eef2ff;
    user-select: none;
    -webkit-user-select: none;
}

#game-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
    touch-action: none;
}

/* ============================================================
   HUD
   ============================================================ */
.game-hud {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 10;
}
.game-hud > * { pointer-events: auto; }

.game-hud-left {
    position: absolute;
    top: 20px; left: 22px;
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* ---- health ---- */
.game-hp { display: flex; gap: 6px; }
.game-hp-shard {
    width: 15px; height: 22px;
    background: linear-gradient(180deg, #ff6b8a, #d1244c);
    clip-path: polygon(50% 0%, 100% 32%, 78% 100%, 22% 100%, 0% 32%);
    box-shadow: 0 0 12px rgba(255,107,138,.7);
    transition: transform .2s ease, opacity .3s ease, filter .3s ease;
}
.game-hp-shard.empty {
    background: rgba(255,255,255,.13);
    box-shadow: none;
    transform: scale(.82);
}

/* ---- zone chip ---- */
.game-zone-chip {
    display: flex; align-items: baseline; gap: 9px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(6,10,20,.72);
    border: 1px solid rgba(255,255,255,.14);
    backdrop-filter: blur(8px);
}
.game-zone-index {
    font-family: var(--font-mono); font-size: .68rem;
    color: var(--accent); letter-spacing: .06em;
}
.game-zone-name {
    font-size: .84rem; font-weight: 600;
    letter-spacing: .12em; text-transform: uppercase;
}

/* ---- record track ---- */
.game-core-track { display: flex; gap: 7px; }
.game-core-pip {
    width: 26px; height: 5px; border-radius: 999px;
    background: rgba(255,255,255,.16);
    transition: background .35s ease, box-shadow .35s ease;
}
.game-core-pip.filled {
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 12px 1px rgba(255,179,71,.75);
}

/* ---- buttons ---- */
.game-hud-right {
    position: absolute;
    top: 20px; right: 22px;
    display: flex; gap: 9px;
}
.game-round-btn {
    width: 38px; height: 38px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(6,10,20,.72);
    border: 1px solid rgba(255,255,255,.14);
    color: #eef2ff;
    cursor: pointer;
    backdrop-filter: blur(8px);
    transition: all .22s ease;
}
.game-round-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-2px); }
#game-mute-btn .ico-off { display: none; }
#game-mute-btn.muted .ico-on { display: none; }
#game-mute-btn.muted .ico-off { display: block; }

/* ---- run progress ---- */
.game-run-progress {
    position: absolute;
    left: 22px; right: 22px; bottom: 16px;
    height: 3px;
    border-radius: 999px;
    background: rgba(255,255,255,.1);
    overflow: hidden;
}
.game-run-progress-fill {
    height: 100%; width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 10px 1px rgba(255,179,71,.6);
    transition: width .35s ease;
}

/* ============================================================
   Interaction prompt (hold-to-extract)
   ============================================================ */
.game-prompt {
    position: absolute;
    left: 50%; bottom: 15%;
    transform: translateX(-50%);
    z-index: 12;
    display: flex; align-items: center; gap: 13px;
    padding: 11px 20px 11px 12px;
    border-radius: 999px;
    background: rgba(6,10,20,.86);
    border: 1px solid rgba(255,255,255,.16);
    backdrop-filter: blur(10px);
    animation: prompt-in .25s ease both;
}
.game-prompt[hidden] { display: none; }
@keyframes prompt-in { from { opacity: 0; transform: translateX(-50%) translateY(10px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
.game-prompt-ring { position: relative; width: 44px; height: 44px; }
.game-prompt-ring svg { transform: rotate(-90deg); }
.game-prompt-ring .ring-bg { fill: none; stroke: rgba(255,255,255,.16); stroke-width: 3; }
.game-prompt-ring .ring-fill {
    fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round;
    stroke-dasharray: 119.4; stroke-dashoffset: 119.4;
    filter: drop-shadow(0 0 5px var(--accent));
}
.game-prompt-key {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-mono); font-size: .84rem; font-weight: 600;
}
.game-prompt-text { font-size: .84rem; letter-spacing: .02em; }

/* ============================================================
   Zone banner
   ============================================================ */
.game-banner {
    position: absolute;
    left: 50%; top: 32%;
    transform: translateX(-50%);
    z-index: 12;
    text-align: center;
    pointer-events: none;
    animation: banner-in .5s cubic-bezier(.16,.84,.44,1) both;
}
.game-banner[hidden] { display: none; }
@keyframes banner-in { from { opacity: 0; transform: translateX(-50%) scale(.9); } to { opacity: 1; transform: translateX(-50%) scale(1); } }
.game-banner.out { animation: banner-out .5s ease both; }
@keyframes banner-out { to { opacity: 0; transform: translateX(-50%) scale(1.05); } }
.game-banner-index {
    font-family: var(--font-mono); font-size: .72rem;
    letter-spacing: .3em; text-transform: uppercase; color: var(--accent);
}
.game-banner-name {
    margin-top: 10px;
    font-size: clamp(2.4rem, 7vw, 4.6rem);
    font-weight: 700; letter-spacing: .06em;
    text-shadow: 0 0 40px rgba(255,179,71,.55);
}
.game-banner-sub { margin-top: 8px; font-size: .9rem; color: rgba(238,242,255,.6); }

/* ============================================================
   Overlays and panels
   ============================================================ */
.game-overlay {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 30px 24px;
    background: rgba(3,5,12,.72);
    backdrop-filter: blur(7px);
    animation: view-fade-in .22s ease both;
}
.game-overlay[hidden] { display: none; }
.game-overlay-solid { background: rgba(3,5,12,.95); }

.game-panel {
    position: relative;
    width: 100%;
    max-width: 620px;
    max-height: 84vh;
    display: flex;
    flex-direction: column;
    background: linear-gradient(165deg, rgba(16,22,40,.98), rgba(8,11,22,.98));
    border: 1px solid rgba(255,179,71,.32);
    border-radius: 18px;
    box-shadow: 0 40px 100px -30px rgba(0,0,0,1), 0 0 70px -26px rgba(255,179,71,.5);
    overflow: hidden;
    animation: modal-pop .28s cubic-bezier(.16,.84,.44,1) both;
}
.game-panel-archive { max-width: 720px; }

.game-panel-head {
    padding: 24px 28px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.game-panel-tag {
    display: inline-flex; align-items: center; gap: 6px;
    font-family: var(--font-mono); font-size: .6rem;
    letter-spacing: .22em; text-transform: uppercase;
    padding: 5px 11px; border-radius: 999px;
    background: rgba(255,179,71,.15); color: var(--accent);
}
.game-tag-warn { background: rgba(244,114,182,.16); color: #f472b6; }
.game-panel-title {
    margin-top: 12px;
    font-size: 1.2rem; font-weight: 600; line-height: 1.35;
}

.game-panel-body {
    padding: 22px 28px;
    overflow-y: auto;
    font-family: 'Inter', sans-serif;
}
.game-record-line { display: flex; gap: 14px; padding: 9px 0; border-bottom: 1px dashed rgba(255,255,255,.07); }
.game-record-line:last-child { border-bottom: 0; }
.game-record-key {
    flex: 0 0 118px;
    font-family: var(--font-mono); font-size: .66rem;
    letter-spacing: .12em; text-transform: uppercase;
    color: var(--accent); padding-top: 3px;
}
.game-record-val { flex: 1; font-size: .88rem; line-height: 1.7; color: rgba(238,242,255,.86); }
.game-record-para { font-size: .9rem; line-height: 1.8; color: rgba(238,242,255,.8); }
.game-record-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.game-record-chips span {
    font-family: var(--font-mono); font-size: .64rem;
    padding: 3px 8px; border-radius: 5px;
    background: rgba(255,255,255,.06);
    border: 1px solid rgba(255,255,255,.1);
    color: rgba(238,242,255,.65);
}

.game-panel-foot {
    padding: 16px 28px 22px;
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    border-top: 1px solid rgba(255,255,255,.08);
}
.game-read-hint {
    font-family: var(--font-mono); font-size: .68rem;
    letter-spacing: .1em; color: rgba(238,242,255,.45);
}
.game-read-bar { height: 3px; background: rgba(255,255,255,.08); }
.game-read-bar-fill {
    height: 100%; width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
    box-shadow: 0 0 8px 1px rgba(255,179,71,.6);
}

.game-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 11px 22px;
    border-radius: 999px;
    font-family: var(--font-display), sans-serif;
    font-size: .85rem; font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all .22s ease;
}
.game-btn-primary {
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    color: #06090f;
    box-shadow: 0 10px 34px -12px rgba(255,179,71,.8);
}
.game-btn-primary:hover:not(:disabled) { transform: translateY(-2px); }
.game-btn-primary:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.game-btn-ghost {
    background: rgba(255,255,255,.05);
    border-color: rgba(255,255,255,.16);
    color: #eef2ff;
}
.game-btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.game-btn-lg { padding: 15px 34px; font-size: .95rem; }

/* ---- quiz ---- */
.game-quiz-question {
    padding: 22px 28px 6px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem; line-height: 1.6;
}
.game-quiz-options {
    padding: 16px 28px 6px;
    display: flex; flex-direction: column; gap: 10px;
    overflow-y: auto;
}
.game-quiz-option {
    text-align: left;
    padding: 14px 18px;
    border-radius: 12px;
    background: rgba(255,255,255,.04);
    border: 1px solid rgba(255,255,255,.12);
    color: #eef2ff;
    font-family: 'Inter', sans-serif;
    font-size: .88rem; line-height: 1.5;
    cursor: pointer;
    transition: all .2s ease;
    display: flex; align-items: center; gap: 12px;
}
.game-quiz-option:hover:not(:disabled) { border-color: var(--accent); background: rgba(255,179,71,.09); transform: translateX(3px); }
.game-quiz-option .opt-key {
    flex-shrink: 0;
    width: 24px; height: 24px; border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,.08);
    font-family: var(--font-mono); font-size: .7rem;
}
.game-quiz-option.correct { border-color: #4ade80; background: rgba(74,222,128,.14); }
.game-quiz-option.correct .opt-key { background: #4ade80; color: #06090f; }
.game-quiz-option.wrong { border-color: #f87171; background: rgba(248,113,113,.13); animation: shake .4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-7px)} 75%{transform:translateX(7px)} }
.game-quiz-option:disabled { cursor: default; }

.game-quiz-feedback {
    padding: 8px 28px 0;
    min-height: 1.6em;
    font-size: .84rem;
    font-family: 'Inter', sans-serif;
    color: rgba(238,242,255,.62);
}
.game-quiz-feedback.ok { color: #4ade80; }
.game-quiz-feedback.bad { color: #f87171; }

/* ---- archive ---- */
.game-archive-list { padding: 20px 28px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.game-archive-item {
    padding: 16px 18px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(255,255,255,.1);
}
.game-archive-item h4 { font-size: .92rem; font-weight: 600; margin-bottom: 9px; color: var(--accent); }
.game-archive-item .game-record-line { padding: 6px 0; }
.game-archive-item .game-record-key { flex-basis: 104px; }

/* ============================================================
   Title / victory
   ============================================================ */
.game-title-inner {
    max-width: 640px;
    text-align: center;
    max-height: 92vh;
    overflow-y: auto;
    padding: 10px;
}
.game-title-kicker {
    font-family: var(--font-mono); font-size: .7rem;
    letter-spacing: .34em; text-transform: uppercase; color: var(--accent);
}
.game-title-name {
    margin-top: 14px;
    font-size: clamp(2.8rem, 9vw, 5.4rem);
    font-weight: 700; letter-spacing: .1em; line-height: 1;
    background: linear-gradient(120deg, #fff 20%, var(--accent) 60%, var(--accent-2) 95%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.game-title-sub {
    margin-top: 20px;
    font-family: 'Inter', sans-serif;
    font-size: .95rem; line-height: 1.8;
    color: rgba(238,242,255,.66);
}

.game-controls-grid {
    margin-top: 30px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    text-align: left;
}
.game-control {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 16px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(255,255,255,.1);
    font-family: 'Inter', sans-serif;
    font-size: .8rem;
    color: rgba(238,242,255,.75);
}
.game-keys { display: flex; gap: 4px; flex-shrink: 0; }
kbd {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 26px; height: 26px; padding: 0 7px;
    border-radius: 6px;
    background: rgba(255,255,255,.09);
    border: 1px solid rgba(255,255,255,.18);
    border-bottom-width: 2px;
    font-family: var(--font-mono); font-size: .7rem;
    color: #eef2ff;
}

.game-title-tips {
    margin-top: 22px;
    display: flex; flex-direction: column; gap: 9px;
    font-family: 'Inter', sans-serif;
    font-size: .8rem;
    color: rgba(238,242,255,.5);
}
.game-title-tips span { display: inline-flex; align-items: center; gap: 9px; justify-content: center; }
.game-title-tips svg { color: var(--accent); flex-shrink: 0; }

#game-start-btn { margin-top: 30px; }

.game-victory-stats {
    margin-top: 28px;
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.game-victory-stat {
    padding: 18px 12px;
    border-radius: 12px;
    background: rgba(255,255,255,.035);
    border: 1px solid rgba(255,255,255,.1);
}
.game-victory-stat b {
    display: block; font-size: 1.8rem; font-weight: 700;
    background: linear-gradient(120deg, var(--accent), var(--accent-2));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.game-victory-stat span {
    display: block; margin-top: 5px;
    font-family: var(--font-mono); font-size: .62rem;
    letter-spacing: .12em; text-transform: uppercase;
    color: rgba(238,242,255,.5);
}
.game-victory-contact { margin-top: 26px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.game-victory-actions { margin-top: 16px; display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ============================================================
   Touch controls
   ============================================================ */
.game-touch {
    position: absolute;
    inset: auto 0 0 0;
    z-index: 14;
    display: none;
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 22px 26px;
    pointer-events: none;
}
.game-touch > * { pointer-events: auto; }
.game-touch-move, .game-touch-act { display: flex; gap: 12px; align-items: flex-end; }
.game-touch-btn {
    width: 58px; height: 58px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(10,15,28,.72);
    border: 1px solid rgba(255,255,255,.2);
    color: #eef2ff;
    backdrop-filter: blur(8px);
    font-family: var(--font-mono); font-size: .9rem;
    transition: background .12s ease, transform .12s ease;
}
.game-touch-btn.pressed {
    background: rgba(255,179,71,.35);
    transform: scale(.93);
}
.game-touch-jump { width: 74px; height: 74px; border-color: rgba(255,179,71,.5); }

body.touch-device .game-touch { display: flex; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 760px) {
    .game-hud-left { gap: 10px; top: 16px; left: 16px; }
    .game-hud-right { top: 16px; right: 16px; }
    .game-zone-chip { padding: 5px 11px; }
    .game-zone-name { font-size: .72rem; }
    .game-hp-shard { width: 12px; height: 18px; }
    .game-core-pip { width: 18px; }
    .game-controls-grid { grid-template-columns: 1fr; }
    .game-panel-head, .game-panel-body, .game-panel-foot,
    .game-quiz-question, .game-quiz-options, .game-quiz-feedback,
    .game-archive-list { padding-left: 20px; padding-right: 20px; }
    .game-record-line { flex-direction: column; gap: 3px; }
    .game-record-key { flex-basis: auto; }
    .game-panel-foot { flex-direction: column-reverse; align-items: stretch; }
    .game-panel-foot .game-btn { width: 100%; }
    .game-read-hint { text-align: center; }
    .game-victory-stats { grid-template-columns: 1fr; }
    .game-prompt { bottom: 23%; }
}
@media (max-height: 620px) {
    .game-title-name { font-size: clamp(2rem, 7vw, 3.2rem); }
    .game-controls-grid { margin-top: 18px; }
    .game-title-tips { display: none; }
}
