/* 아주 먼 미래, 우리 학교 생태지도 — 디자인
   전자칠판(교사, 큰 글씨)과 태블릿(학생, 터치) 기준. 티치타카 생태지도와 같은 초록 계열. */

:root {
    color-scheme: light;
    --bg: #eef3ee;
    --surface: #ffffff;
    --surface-2: #f6f8f5;
    --line: #dfe6de;
    --ink: #15221a;
    --ink-2: #435349;
    --ink-3: #6c7b72;
    --brand: #047857;
    --brand-2: #10b981;
    --brand-soft: #e3f5ec;
    --hot: #dc2626;
    --hot-2: #f97316;
    --violet: #6d28d9;
    --radius: 20px;
    --shadow: 0 8px 28px rgba(15, 30, 20, 0.14);
    --font: 'Noto Sans KR', system-ui, -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
    --title: 'Black Han Sans', var(--font);
}

* {
    box-sizing: border-box;
}
html,
body {
    margin: 0;
    height: 100%;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}
#app {
    min-height: 100%;
}
[hidden] {
    display: none !important;
}
button,
input,
select,
textarea {
    font: inherit;
    color: inherit;
}
a {
    color: var(--brand);
}
.muted {
    color: var(--ink-3);
}
.small {
    font-size: 13px;
}
.warn {
    color: #b45309;
}
h1,
h2,
h3,
h4 {
    margin: 0;
}

/* ===== 버튼 ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 44px;
    padding: 9px 16px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-weight: 900;
    font-size: 15px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition: transform 0.1s, background 0.15s;
}
.btn:hover {
    background: var(--surface-2);
}
.btn:active {
    transform: scale(0.97);
}
.btn:disabled {
    opacity: 0.55;
    cursor: default;
}
.btn-primary {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.btn-primary:hover {
    background: #03684b;
}
.btn-green {
    background: var(--brand-soft);
    border-color: #b7e4cd;
    color: var(--brand);
}
.btn-hot {
    background: linear-gradient(135deg, var(--hot-2), var(--hot));
    border: 0;
    color: #fff;
}
.btn-hot:hover {
    background: linear-gradient(135deg, #ea580c, #b91c1c);
}
.btn-violet {
    background: var(--violet);
    border-color: var(--violet);
    color: #fff;
}
.btn-violet:hover {
    background: #5b21b6;
}
.btn-danger {
    color: #b91c1c;
    border-color: #f3c4c4;
}
.btn-lg {
    min-height: 54px;
    padding: 12px 22px;
    font-size: 17px;
}
.btn-small {
    min-height: 36px;
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 12px;
}
.btn-float {
    box-shadow: var(--shadow);
    border: 0;
}
.btn-big {
    min-height: 62px;
    padding: 14px 24px;
    font-size: 19px;
    border-radius: 18px;
}
.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 0;
    background: var(--surface-2);
    font-weight: 900;
    cursor: pointer;
}
.btn:focus-visible,
.icon-btn:focus-visible,
.seg button:focus-visible,
.bubble:focus-visible {
    outline: 3px solid rgba(16, 185, 129, 0.55);
    outline-offset: 2px;
}
.row {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.row.between {
    justify-content: space-between;
}
.row-end {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 12px;
}
.tag {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand);
    font-size: 12px;
    font-weight: 900;
    vertical-align: 2px;
}

/* ===== 가운데 카드 (로그인·학반) ===== */
.center-card {
    width: min(560px, calc(100% - 32px));
    margin: 8vh auto;
    padding: 32px;
    background: var(--surface);
    border-radius: 26px;
    box-shadow: var(--shadow);
    text-align: center;
}
.center-card h1 {
    font-family: var(--title);
    font-weight: 400;
    font-size: 30px;
    color: var(--brand);
    margin-bottom: 6px;
    word-break: keep-all; /* 낱말 가운데서 줄이 바뀌지 않게 */
}
.logo {
    font-size: 64px;
    line-height: 1;
    margin-bottom: 8px;
}
/* 첫 화면 지구: 마우스를 올리면(태블릿·휴대폰은 누를 때마다) 옆으로 뒤집혀 화난 지구가 보임.
   뒤집힘 상태(.flipped)는 js/app.js 의 setupFlipEarth() 가 정함 */
.flip-earth {
    width: 96px;
    height: 96px;
    margin: 0 auto 8px;
    perspective: 600px;
    touch-action: manipulation; /* 두 번 눌러 확대 막기 */
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
}
.flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: transform 0.6s ease;
}
.flip-earth.flipped .flip-inner {
    transform: rotateY(180deg);
}
.flip-inner img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    -webkit-touch-callout: none; /* 길게 눌러도 '이미지 저장' 메뉴가 뜨지 않게 */
    -webkit-user-drag: none;
    pointer-events: none;
}
.flip-back {
    transform: rotateY(180deg);
}
@media (prefers-reduced-motion: reduce) {
    .flip-inner {
        transition: none;
    }
}
.form {
    display: grid;
    gap: 12px;
    text-align: left;
    margin-top: 16px;
}
.form label {
    display: grid;
    gap: 4px;
    font-weight: 700;
    font-size: 14px;
    color: var(--ink-2);
}
input,
select,
textarea {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    font-size: 16px;
}
textarea {
    resize: vertical;
}
input[type='checkbox'],
input[type='radio'] {
    width: 22px;
    min-height: 22px;
    accent-color: var(--brand);
}
.form-error {
    margin: 0;
    color: #b91c1c;
    font-size: 14px;
    min-height: 1em;
}
.demo-login {
    display: grid;
    gap: 12px;
    margin-top: 18px;
}
.demo-badge {
    margin: 0;
    padding: 8px 12px;
    border-radius: 12px;
    background: #fff7e0;
    color: #6b4e00;
    font-size: 14px;
}

.lobby {
    text-align: left;
}
.lobby-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.lobby-head h1 {
    font-size: 24px;
}
.lobby h2 {
    font-size: 16px;
    margin: 22px 0 8px;
}
.join-form label {
    font-weight: 700;
}
.join-form .row {
    margin-top: 6px;
    flex-wrap: nowrap;
}
.join-form input {
    font-size: 24px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    font-weight: 900;
    text-align: center;
}
.class-list {
    display: grid;
    gap: 8px;
}
.class-item {
    display: grid;
    gap: 2px;
    text-align: left;
    padding: 14px 16px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    cursor: pointer;
}
.class-item:hover {
    border-color: var(--brand-2);
}
.create-box {
    margin-top: 20px;
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--brand-soft);
}
.create-box summary {
    cursor: pointer;
    font-weight: 900;
}

/* ===== 화면 공통 (꽉 찬 화면 + 떠 있는 버튼) ===== */
.screen {
    position: fixed;
    inset: 0;
    overflow: hidden;
}
.hud-tl,
.hud-tr,
.hud-tc,
.hud-bl,
.hud-br,
.hud-bc,
.hud-lm {
    position: absolute;
    z-index: 20;
}
.hud-tl {
    left: 16px;
    top: 16px;
}
.hud-tr {
    right: 16px;
    top: 16px;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}
.hud-tc {
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
}
.hud-bl {
    left: 16px;
    bottom: 18px;
}
.hud-br {
    right: 16px;
    bottom: 18px;
}
.hud-bc {
    left: 50%;
    bottom: 18px;
    transform: translateX(-50%);
}
.hud-lm {
    left: 16px;
    top: 50%;
    transform: translateY(-50%);
}

.class-card {
    min-width: 230px;
    max-width: 320px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    box-shadow: var(--shadow);
}
.class-name {
    font-weight: 900;
    font-size: 17px;
}
.class-who {
    font-size: 14px;
    color: var(--ink-2);
    margin: 2px 0 8px;
}
.class-who .code {
    letter-spacing: 0.1em;
    color: var(--brand);
}
.team-badge {
    display: inline-block;
    padding: 2px 12px;
    border-radius: 999px;
    background: var(--brand);
    color: #fff;
    font-size: 18px;
}
.class-actions {
    display: flex;
    gap: 6px;
}

/* ===== 1차시: 키워드 ===== */
.kw-screen {
    background: linear-gradient(180deg, #f4f9ff 0%, #eef6f1 100%);
}
.kw-bg {
    position: absolute;
    inset: 0;
    opacity: 0.28;
    filter: saturate(0.6);
    pointer-events: none;
}
.kw-bg-plain {
    opacity: 0;
}
.join-code-card {
    flex-direction: column;
    align-items: center !important;
    gap: 0 !important;
    padding: 10px 18px;
    background: rgba(255, 255, 255, 0.96);
    border-radius: 18px;
    box-shadow: var(--shadow);
    font-weight: 700;
    color: var(--ink-2);
}
.join-code-card b {
    font-size: 38px;
    letter-spacing: 0.14em;
    color: var(--brand);
    line-height: 1.15;
}
.kw-question {
    position: absolute;
    left: 50%;
    top: 104px;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 980px;
    text-align: center;
    font-family: var(--title);
    font-weight: 400;
    font-size: clamp(26px, 4vw, 46px);
    color: #1e3a8a;
    z-index: 5;
}
.kw-question span {
    color: #2563eb;
}
.kw-cloud {
    position: absolute;
    left: 16px;
    right: 16px;
    top: 180px;
    bottom: 150px;
    z-index: 4;
}
.kw-empty {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--ink-3);
    font-size: 22px;
    font-weight: 700;
}
.bubble {
    position: absolute;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 0;
    color: #fff;
    font-weight: 900;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 6px;
    text-align: center;
    line-height: 1.15;
    word-break: keep-all;
    overflow-wrap: anywhere;
    box-shadow: 0 6px 18px rgba(30, 58, 138, 0.25), inset 0 -4px 0 rgba(0, 0, 0, 0.12);
    transition: left 0.5s, top 0.5s, width 0.5s, height 0.5s;
    cursor: default;
}
.bubble small {
    font-size: 0.6em;
    opacity: 0.85;
}
.bubble.pop {
    animation: pop 0.55s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes pop {
    from {
        transform: translate(-50%, -50%) scale(0.1);
    }
    to {
        transform: translate(-50%, -50%) scale(1);
    }
}
.kw-bottom {
    position: absolute;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    width: min(760px, calc(100% - 32px));
    z-index: 10;
}
.kw-input {
    display: flex;
    gap: 10px;
    padding: 10px;
    background: #2563eb;
    border-radius: 22px;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.35);
}
.kw-input input {
    flex: 1;
    min-height: 56px;
    border: 0;
    background: #fff;
    font-size: 20px;
    font-weight: 700;
    border-radius: 16px;
}
.kw-input .btn {
    background: #1e3a8a;
    border: 0;
    min-height: 56px;
}
.kw-foot {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-top: 10px;
    font-size: 14px;
    color: var(--ink-2);
    font-weight: 700;
}

/* ===== 2차시: 지도 (위 줄 · 가운데 줄 · 아래 줄) ===== */
.hud-stack {
    position: absolute;
    z-index: 20;
    left: 0;
    right: 0;
    top: 0;
    pointer-events: none;
}
.hud-top {
    position: absolute;
    z-index: 20;
    left: 16px;
    right: 16px;
    top: 16px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    pointer-events: none;
}
.hud-top > *,
.hud-row2 > *,
.hud-bottom > * {
    pointer-events: auto;
}
.hud-top .hud-tl {
    position: static;
}
.hud-row2 {
    position: absolute;
    z-index: 20;
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
    align-items: center;
    pointer-events: none;
}
.map-screen .alerts {
    position: absolute;
    z-index: 21;
    right: 16px;
    top: 80px;
}
.hud-bottom {
    position: absolute;
    z-index: 20;
    left: 16px;
    right: 16px;
    bottom: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    pointer-events: none;
}
.hud-bar {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 10px;
}
.lbl-s {
    display: none;
}
.leaflet-container {
    font-family: var(--font);
}
.lf-icon {
    background: none !important;
    border: 0 !important;
}
.lf-center {
    position: absolute;
    left: 0;
    top: 0;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    width: max-content;
}
/* 지도 조작 버튼·출처 표시가 위·아래 버튼에 가리지 않게 */
.map-screen .leaflet-top {
    top: 76px;
}
.map-screen .leaflet-bottom {
    bottom: 84px;
}
.map-screen .leaflet-control-attribution {
    font-size: 10px;
}

.main-map {
    position: absolute;
    inset: 0;
    background: #e6ede5;
}
.heat-tint {
    position: absolute;
    inset: 0;
    z-index: 3;
    pointer-events: none;
    opacity: 0;
    background: radial-gradient(circle at 50% 50%, rgba(249, 115, 22, 0.55), rgba(220, 38, 38, 0.7));
    mix-blend-mode: multiply;
    transition: opacity 0.4s;
}
.seg {
    display: inline-flex;
    padding: 4px;
    gap: 4px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
}
.seg button {
    min-height: 44px;
    padding: 8px 20px;
    white-space: nowrap;
    border: 0;
    border-radius: 12px;
    background: transparent;
    font-weight: 900;
    font-size: 17px;
    color: var(--ink-3);
    cursor: pointer;
}
.seg button[aria-pressed='true'] {
    background: var(--brand);
    color: #fff;
}
.seg.small {
    box-shadow: none;
    background: var(--surface-2);
}
.seg.small button {
    min-height: 34px;
    padding: 4px 12px;
    font-size: 14px;
}
.seg.big button {
    padding: 12px 22px;
    line-height: 1.25;
}
.seg.big button small {
    font-weight: 700;
    font-size: 12px;
    opacity: 0.85;
}
.pill {
    padding: 10px 16px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    font-weight: 700;
}

.bell {
    position: relative;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 0;
    background: #f59e0b;
    color: #fff;
    font-weight: 900;
    font-size: 24px;
    box-shadow: var(--shadow);
    cursor: pointer;
}
.bell span {
    position: absolute;
    right: -4px;
    top: -4px;
    min-width: 22px;
    height: 22px;
    border-radius: 11px;
    background: var(--hot);
    font-size: 13px;
    line-height: 22px;
}
.alerts {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: min(340px, calc(100vw - 32px));
}
.alerts.collapsed {
    display: none;
}
.alert-card {
    display: grid;
    grid-template-columns: 40px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.97);
    border-radius: 18px;
    box-shadow: var(--shadow);
    animation: slidein 0.45s ease-out;
}
@keyframes slidein {
    from {
        opacity: 0;
        transform: translateX(40px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.alert-icon {
    font-size: 28px;
    text-align: center;
}
.alert-text {
    font-weight: 700;
    font-size: 15px;
    color: var(--ink-2);
}
.alert-value {
    font-size: 20px;
    color: var(--hot);
    white-space: nowrap;
}

.map-legend {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px 14px;
    padding: 8px 14px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-2);
    max-width: calc(100% - 32px);
}
.map-legend.inline {
    background: none;
    padding: 6px 0 0;
    justify-content: flex-start;
}
.map-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}
.lg {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid #fff;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
    font-style: normal;
    font-size: 11px;
}
.lg-ok {
    background: var(--brand-2);
}
.lg-gone {
    background: none;
    border: 0;
    box-shadow: none;
    color: #6b7280;
    font-weight: 900;
    font-size: 16px;
}
.lg-part {
    background: var(--brand-2);
    opacity: 0.45;
    border-style: dashed;
    border-color: #475569;
}
.lg-new {
    background: none;
    border: 0;
    box-shadow: none;
    color: #d97706;
    font-size: 18px;
}
.lg-fac {
    border-radius: 4px;
    background: #64748b;
}
.map-status {
    position: absolute;
    z-index: 25;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    padding: 16px 22px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: var(--shadow);
    font-weight: 700;
    text-align: center;
    max-width: calc(100% - 32px);
}
.caption {
    position: absolute;
    z-index: 30;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(760px, calc(100% - 40px));
    padding: 26px 32px;
    border-radius: 26px;
    background: rgba(15, 23, 20, 0.86);
    color: #fff;
    text-align: center;
    font-size: clamp(22px, 3.2vw, 38px);
    font-weight: 700;
    line-height: 1.4;
    pointer-events: none;
}
.caption.show {
    animation: fadein 0.6s ease-out;
}
.caption b {
    color: #fdba74;
}
@keyframes fadein {
    from {
        opacity: 0;
        transform: translate(-50%, -46%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}
/* 미래 보기 동안 아래쪽 자막 (버튼 줄 바로 위) */
.subtitle {
    position: absolute;
    z-index: 29;
    left: 50%;
    bottom: 130px;
    transform: translateX(-50%);
    width: max-content;
    max-width: min(1000px, calc(100% - 32px));
    padding: 12px 26px;
    border-radius: 16px;
    background: rgba(15, 23, 20, 0.82);
    color: #fff;
    text-align: center;
    font-size: clamp(17px, 2.1vw, 28px);
    font-weight: 700;
    line-height: 1.45;
    pointer-events: none;
    word-break: keep-all;
}
.subtitle.show {
    animation: subin 0.35s ease-out;
}
.subtitle b {
    color: #fdba74;
}
.subtitle small {
    display: inline-block;
    margin-top: 2px;
    font-size: 0.78em;
    font-weight: 600;
    color: #e5e7eb;
}
.subtitle .sub-people {
    color: #bae6fd;
}
@keyframes subin {
    from {
        opacity: 0;
        transform: translate(-50%, 8px);
    }
    to {
        opacity: 1;
        transform: translate(-50%, 0);
    }
}
.sum-title {
    font-family: var(--title);
    font-weight: 400;
    margin-bottom: 10px;
    color: #fdba74;
}
.sum-row {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    font-size: 0.8em;
    padding: 4px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.sum-row b {
    color: #fff;
}
.sum-q {
    margin-top: 14px;
    font-size: 0.75em;
    color: #fde68a;
}
.temp-counter {
    position: absolute;
    z-index: 28;
    left: 50%;
    top: 90px;
    transform: translateX(-50%);
    padding: 10px 24px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.95);
    box-shadow: var(--shadow);
    font-size: 34px;
    color: var(--hot);
    display: flex;
    align-items: baseline;
    gap: 10px;
}
.temp-counter small {
    font-size: 16px;
    color: var(--ink-2);
    font-weight: 700;
}

/* 지도 위 점·시설·새로 온 생물 (카카오 오버레이) */
.dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--c, #64748b);
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
    cursor: pointer;
    transition: all 0.35s;
}
.dot-gone {
    background: none;
    border: 0;
    box-shadow: none;
    width: 16px;
    height: 16px;
    position: relative;
}
.dot-gone::before {
    content: '✕';
    position: absolute;
    inset: 0;
    color: #6b7280;
    font-weight: 900;
    font-size: 15px;
    line-height: 16px;
    text-align: center;
    text-shadow: 0 0 3px #fff, 0 0 3px #fff;
}
.dot-partial {
    opacity: 0.5;
    border-style: dashed;
    border-color: #334155;
}
.fac {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    background: #334155;
    color: #fff;
    font-weight: 900;
    font-size: 14px;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: drop 0.5s cubic-bezier(0.2, 1.5, 0.4, 1);
}
.fac-green {
    background: #15803d;
}
.fac-emoji {
    font-size: 20px;
}
.fac-count {
    font-size: 12px;
    opacity: 0.8;
}
@keyframes drop {
    from {
        opacity: 0;
        transform: translateY(-60px) scale(0.6);
    }
    to {
        opacity: 1;
        transform: none;
    }
}
.newcomer {
    display: flex;
    align-items: center;
    gap: 3px;
    color: #d97706;
    font-size: 22px;
    font-weight: 900;
    text-shadow: 0 0 4px #fff, 0 0 4px #fff;
    cursor: pointer;
    animation: pop2 0.6s cubic-bezier(0.2, 1.6, 0.4, 1);
}
.newcomer span {
    font-size: 12px;
    color: #92400e;
    background: rgba(255, 251, 235, 0.95);
    padding: 1px 6px;
    border-radius: 8px;
    text-shadow: none;
}
@keyframes pop2 {
    from {
        transform: scale(0.1);
    }
    to {
        transform: scale(1);
    }
}

/* 간단한 지도 (SVG) */
.svg-map {
    display: block;
    width: 100%;
    height: 100%;
    background: #e9f0e7;
}
.svg-note {
    font-size: 12px;
    fill: var(--ink-3);
}
.svg-area {
    fill: rgba(255, 255, 255, 0.5);
    stroke: #10b981;
    stroke-width: 2;
    stroke-dasharray: 6 5;
}
.svg-fac {
    fill: rgba(100, 116, 139, 0.55);
    stroke: #475569;
}
.svg-fac.green {
    fill: rgba(34, 197, 94, 0.3);
    stroke: #15803d;
}
.svg-fac-label {
    font-size: 13px;
    font-weight: 900;
    fill: #1e293b;
    text-anchor: middle;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 3px;
}
.svg-dot circle {
    fill: var(--c);
    stroke: #fff;
    stroke-width: 1.5;
}
.svg-dot path {
    display: none;
    stroke: #6b7280;
    stroke-width: 2.5;
    stroke-linecap: round;
}
.svg-dot.svg-gone circle {
    display: none;
}
.svg-dot.svg-gone path {
    display: block;
}
.svg-dot.svg-partial circle {
    fill-opacity: 0.45;
    stroke: #334155;
    stroke-dasharray: 2 2;
}
.svg-dot.svg-hidden {
    display: none;
}
.svg-new {
    font-size: 13px;
    font-weight: 900;
    fill: #b45309;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 3px;
}

/* ===== 창 ===== */
.modal {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(10, 20, 14, 0.5);
}
.modal-box {
    width: min(620px, 100%);
    max-height: calc(100vh - 32px);
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border-radius: 24px;
    box-shadow: var(--shadow);
    overflow: hidden;
}
.modal-box.small {
    width: min(440px, 100%);
}
.modal-box.wide {
    width: min(860px, 100%);
}
.modal-box.full {
    width: min(1280px, 100%);
    height: calc(100vh - 32px);
}
.modal-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.modal-head h2 {
    font-size: 20px;
}
.modal-body {
    padding: 18px 20px 22px;
    overflow: auto;
    flex: 1;
}
.confirm-text {
    font-size: 17px;
    margin: 4px 0 8px;
}

#toasts {
    position: fixed;
    z-index: 300;
    left: 50%;
    top: 16px;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    pointer-events: none;
}
.toast {
    padding: 12px 18px;
    border-radius: 14px;
    background: rgba(21, 34, 26, 0.94);
    color: #fff;
    font-weight: 700;
    box-shadow: var(--shadow);
    max-width: min(560px, calc(100vw - 32px));
    animation: fadein2 0.3s;
    transition: opacity 0.4s;
}
.toast-ok {
    background: #047857;
}
.toast-error {
    background: #b91c1c;
}
.toast.out {
    opacity: 0;
}
@keyframes fadein2 {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
}

.kw-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.kw-chip {
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--b);
    color: #fff;
    font-weight: 900;
    font-size: 18px;
}
.kw-chip small {
    margin-left: 6px;
    opacity: 0.8;
}

/* ===== 비교 ===== */
.cmp-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}
.stat {
    padding: 12px 14px;
    border-radius: 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.stat span {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--ink-3);
}
.stat b {
    font-size: 26px;
}
.stat small {
    font-size: 15px;
    color: var(--ink-2);
    margin-left: 2px;
}
.cmp-sec {
    margin: 0 0 22px;
}
.cmp-sec h3 {
    font-size: 18px;
    margin-bottom: 10px;
}
.sec-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}
.sec-head h3 {
    margin: 0;
}
.mini-maps {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.mini-maps figure {
    margin: 0;
    padding: 10px;
    border-radius: 18px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.mini-maps figcaption {
    font-weight: 900;
    margin-bottom: 4px;
}
.mini {
    display: block;
    width: 100%;
    height: auto;
    max-height: 46vh;
}
.mini-area {
    fill: #eef6ec;
    stroke: #10b981;
    stroke-dasharray: 5 4;
}
.mini-fac {
    fill: rgba(100, 116, 139, 0.5);
    stroke: #475569;
}
.mini-fac.green {
    fill: rgba(34, 197, 94, 0.28);
    stroke: #15803d;
}
.mini-dot {
    stroke: #fff;
    stroke-width: 1.2;
}
.mini-gone {
    font-size: 12px;
    font-weight: 900;
    fill: #6b7280;
    text-anchor: middle;
}
.mini-new {
    font-size: 17px;
    fill: #d97706;
    text-anchor: middle;
    paint-order: stroke;
    stroke: #fff;
    stroke-width: 2px;
}
.chart-legend {
    display: flex;
    gap: 16px;
    font-size: 14px;
    font-weight: 700;
    color: var(--ink-2);
}
.chart-legend i {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 4px;
    vertical-align: -2px;
    margin-right: 5px;
}
.chart {
    display: block;
    width: 100%;
    max-width: 760px;
    height: auto;
}
.chart .axis {
    stroke: #c9d2c8;
}
.bar-val {
    font-size: 14px;
    font-weight: 900;
    fill: var(--ink);
}
.bar-label {
    font-size: 14px;
    font-weight: 700;
    fill: var(--ink-2);
}
.tabs-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}
.tabs-row button {
    min-height: 42px;
    padding: 6px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-weight: 900;
    cursor: pointer;
    color: var(--ink-2);
}
.tabs-row button[aria-pressed='true'] {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}
.species-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 10px;
}
.sp-card {
    display: grid;
    grid-template-columns: 76px 1fr;
    gap: 10px;
    padding: 10px;
    border-radius: 16px;
    border: 1px solid var(--line);
    background: var(--surface);
}
.sp-gone {
    background: #f8f8f8;
}
.sp-new {
    border-color: #fcd34d;
    background: #fffbeb;
}
.sp-pic {
    width: 76px;
    height: 76px;
    border-radius: 12px;
    overflow: hidden;
    background: var(--surface-2);
    display: flex;
    align-items: center;
    justify-content: center;
}
.sp-pic img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.sp-gone .sp-pic img {
    filter: grayscale(1);
}
.sp-emoji {
    font-size: 34px;
}
.sp-body b {
    display: block;
    font-size: 16px;
}
.sp-body ul {
    margin: 4px 0 0;
    padding-left: 16px;
    font-size: 13px;
    color: var(--ink-2);
}
.cmp-more {
    margin: 0 0 12px;
    padding: 12px 16px;
    border-radius: 16px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.cmp-more summary {
    cursor: pointer;
    font-weight: 900;
    font-size: 16px;
}
.cmp-more > div {
    margin-top: 12px;
}
.source {
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
}
.source p {
    margin: 2px 0;
}
table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
}
table.data th,
table.data td {
    padding: 9px 10px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}
table.data th {
    font-size: 13px;
    color: var(--ink-3);
    background: var(--surface-2);
}
.table-scroll {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 14px;
}

/* ===== 갤러리 ===== */
.gal-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}
.results {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 18px;
    background: #fffbeb;
    border: 1px solid #fde68a;
}
.results h3 {
    margin-bottom: 8px;
}
.rank {
    font-weight: 900;
    font-size: 20px;
}
.rank-1 {
    color: #ca8a04;
}
.rank-2 {
    color: #64748b;
}
.rank-3 {
    color: #b45309;
}
.stars {
    display: inline-block;
    width: 80px;
    height: 16px;
    vertical-align: -2px;
    background: linear-gradient(90deg, #f59e0b var(--v), #e5e7eb var(--v));
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 16'%3E%3Cg%3E%3Cpath d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3Cpath transform='translate(16)' d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3Cpath transform='translate(32)' d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3Cpath transform='translate(48)' d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3Cpath transform='translate(64)' d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 80 16'%3E%3Cg%3E%3Cpath d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3Cpath transform='translate(16)' d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3Cpath transform='translate(32)' d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3Cpath transform='translate(48)' d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3Cpath transform='translate(64)' d='M8 0l2.4 5 5.6.6-4.2 3.8 1.2 5.6L8 12.2 3 15l1.2-5.6L0 5.6 5.6 5z'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.poster-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 14px;
}
.poster-card {
    position: relative;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    border: 1px solid var(--line);
    background: var(--surface);
    overflow: hidden;
}
.poster-card.mine {
    border: 2px solid var(--brand-2);
}
.rank-badge {
    position: absolute;
    left: 10px;
    top: 10px;
    z-index: 2;
    padding: 4px 12px;
    border-radius: 999px;
    background: #fff;
    font-weight: 900;
    box-shadow: var(--shadow);
}
.poster-img {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 3 / 4;
    border: 0;
    padding: 0;
    background: var(--surface-2);
    cursor: zoom-in;
}
.poster-img:disabled {
    cursor: default;
}
.poster-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.poster-info {
    padding: 12px 14px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.poster-info h4 {
    font-size: 17px;
}
.poster-desc {
    margin: 0;
    font-size: 14px;
    color: var(--ink-2);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    white-space: pre-line;
}
.poster-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: auto;
    padding-top: 4px;
}
.poster-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 180px;
    max-height: 40vh;
    border-radius: 16px;
    background: var(--surface-2);
    overflow: hidden;
}
.poster-preview img {
    max-width: 100%;
    max-height: 40vh;
    object-fit: contain;
}
.rate-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--line);
    font-weight: 900;
    font-size: 17px;
}
.star-input {
    display: flex;
    gap: 2px;
}
.star-input button {
    width: 46px;
    height: 46px;
    border: 0;
    background: none;
    font-size: 34px;
    color: #d1d5db;
    cursor: pointer;
    padding: 0;
}
.star-input button.on {
    color: #f59e0b;
}
.present {
    position: fixed;
    inset: 0;
    z-index: 200;
    background: #0b0f0d;
    color: #fff;
    display: grid;
    grid-template-columns: 70px 1fr minmax(260px, 30%) 70px;
    align-items: center;
}
.present-img {
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}
.present-img img {
    max-width: 100%;
    max-height: calc(100vh - 48px);
    object-fit: contain;
    border-radius: 10px;
}
.present-side {
    padding: 24px;
    max-height: 100vh;
    overflow: auto;
}
.present-side h2 {
    font-family: var(--title);
    font-weight: 400;
    font-size: 40px;
    color: #86efac;
    margin-bottom: 14px;
}
.present-side h2 span {
    font-size: 30px;
    color: #fff;
}
.present-side p {
    font-size: 20px;
    line-height: 1.65;
    white-space: pre-line;
}
.present-nav,
.present-x {
    border: 0;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 40px;
    cursor: pointer;
}
.present-nav {
    height: 120px;
    border-radius: 16px;
    margin: 0 10px;
}
.present-x {
    position: absolute;
    right: 16px;
    top: 16px;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    font-size: 22px;
    z-index: 2;
}

/* ===== 교사 관리 ===== */
.tp-body {
    padding-top: 4px;
}
.tp-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 14px;
}
.tp-card {
    padding: 16px 18px;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: var(--surface-2);
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tp-card h3 {
    font-size: 17px;
}
.code-card {
    align-items: center;
    text-align: center;
    background: var(--brand-soft);
}
.big-code {
    font-size: 54px;
    letter-spacing: 0.16em;
    color: var(--brand);
    line-height: 1.1;
}
.danger-zone {
    border-color: #f3c4c4;
    background: #fff7f7;
}
.tp-form {
    max-width: 720px;
}
.tp-form h3 {
    margin-top: 10px;
}
.radio,
.switch {
    display: flex !important;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-weight: 700;
    cursor: pointer;
}
.radio select {
    width: auto;
    min-width: 200px;
}
.kw-table select {
    min-width: 150px;
}

/* ===== 기타 ===== */
.spinner {
    width: 48px;
    height: 48px;
    margin: 0 auto 10px;
    border-radius: 50%;
    border: 5px solid #cfe9dc;
    border-top-color: var(--brand-2);
    animation: spin 0.9s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}
.demo-ribbon {
    display: none;
}
body.demo .demo-ribbon {
    display: block;
    position: fixed;
    z-index: 400;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    padding: 1px 12px;
    border-radius: 0 0 10px 10px;
    background: #f59e0b;
    color: #fff;
    font-size: 12px;
    font-weight: 900;
    pointer-events: none;
}

/* 태블릿 세로·좁은 화면 */
@media (max-width: 820px) {
    .cmp-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .mini-maps {
        grid-template-columns: 1fr;
    }
    .present {
        grid-template-columns: 1fr;
        overflow: auto;
    }
    .present-nav {
        display: none;
    }
    .present-img {
        height: auto;
    }
    .kw-question {
        top: 150px;
    }
    .kw-cloud {
        top: 230px;
    }
    .hud-tc {
        top: auto;
        bottom: 160px;
    }
    /* 2차시 지도: 좁은 화면 — 위쪽은 차례로 쌓음 */
    .hud-stack {
        padding: 10px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .hud-stack .hud-top,
    .hud-stack .hud-row2,
    .hud-stack .alerts {
        position: static;
        transform: none;
    }
    .map-screen .class-name {
        font-size: 15px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .map-screen .class-who {
        font-size: 12px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .map-screen .class-actions .btn {
        min-height: 34px;
        padding: 4px 10px;
    }
    .bell {
        width: 46px;
        height: 46px;
        font-size: 21px;
        flex: none;
    }
    .map-screen .class-card {
        display: grid;
        grid-template-columns: 1fr auto;
        align-items: center;
        gap: 0 10px;
        min-width: 0;
        max-width: none;
        padding: 8px 12px;
    }
    .map-screen .class-who {
        margin: 0;
    }
    .map-screen .class-actions {
        grid-column: 2;
        grid-row: 1 / span 2;
    }
    .hud-top .hud-tl {
        flex: 1;
        min-width: 0;
    }
    .hud-row2 {
        justify-content: space-between;
    }
    .hud-row2 .seg button {
        min-height: 40px;
        padding: 6px 16px;
        font-size: 15px;
    }
    .map-screen .alerts {
        width: auto;
        gap: 5px;
        pointer-events: auto;
    }
    .alert-card {
        grid-template-columns: 26px 1fr auto;
        gap: 8px;
        padding: 6px 12px;
        border-radius: 14px;
    }
    .alert-icon {
        font-size: 18px;
    }
    .alert-text {
        font-size: 13px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }
    .alert-value {
        font-size: 15px;
    }
    .hud-bottom {
        left: 10px;
        right: 10px;
        bottom: 10px;
        gap: 8px;
    }
    .hud-bar .btn {
        flex: 1;
        min-height: 54px;
        padding: 8px 10px;
        font-size: 16px;
    }
    .lbl-l {
        display: none;
    }
    .lbl-s {
        display: inline;
    }
    .map-legend {
        gap: 3px 10px;
        padding: 5px 10px;
        font-size: 12px;
    }
    .map-screen .leaflet-control-zoom {
        display: none; /* 손가락으로 확대 */
    }
    .map-screen .leaflet-bottom {
        bottom: 130px;
    }
    .fac {
        font-size: 11px;
        padding: 2px 7px 2px 4px;
    }
    .fac-emoji {
        font-size: 15px;
    }
    .fac-text,
    .fac-count {
        display: none; /* 좁은 화면에서는 그림만 (이름은 [💭 키워드]·비교 화면에서) */
    }
    .newcomer {
        font-size: 17px;
    }
    .newcomer span {
        font-size: 10px;
    }
}
@media (max-width: 560px) {
    .class-card {
        min-width: 0;
        max-width: calc(100vw - 100px);
    }
    .join-code-card b {
        font-size: 26px;
    }
}

/* 국가 기후변화 생물지표종 표시 */
.ind-badge {
    display: inline-block;
    margin-bottom: 2px;
    padding: 1px 8px;
    border-radius: 999px;
    background: #fff1e6;
    color: #c2410c;
    font-size: 11px;
    font-weight: 900;
}
.ind-summary {
    margin: 0 0 10px;
    padding: 8px 12px;
    border-radius: 12px;
    background: #fff7ed;
    color: #7c2d12;
    font-size: 14px;
}

/* ===== 1차시: 참여 QR, 오늘의 생태지도 ===== */
.join-code-card .join-code-text {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.join-code-card #btn-today {
    margin-top: 6px;
}
.qr-mini {
    width: 92px;
    height: 92px;
    padding: 0;
    margin-bottom: 4px;
    border: 0;
    background: #fff;
    cursor: zoom-in;
}
.qr-mini svg,
.qr-big svg {
    display: block;
    width: 100%;
    height: 100%;
}
.qr-none {
    display: grid;
    place-items: center;
    width: 100%;
    height: 100%;
    border: 2px dashed var(--line);
    border-radius: 10px;
    color: var(--ink-3);
    font-size: 13px;
}
.qr-big {
    width: min(420px, 70vw);
    aspect-ratio: 1;
    margin: 0 auto;
    background: #fff;
}
.qr-code {
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    margin: 12px 0 4px;
}
.qr-code b {
    font-size: 40px;
    letter-spacing: 0.14em;
    color: var(--brand);
}
.qr-modal .muted {
    text-align: center;
}
.qr-url {
    word-break: break-all;
}
.today-modal .modal-body {
    padding: 0;
}
.today-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    height: min(calc(100vh - 130px), 900px);
}
.today-map {
    position: relative;
    min-height: 360px;
}
.today-side {
    padding: 16px 18px;
    overflow: auto;
    border-left: 1px solid var(--line);
}
.today-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 10px;
}
.today-types {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
    font-size: 14px;
}
.today-types span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
.today-side h4 {
    margin: 14px 0 6px;
}
.today-top {
    margin: 0;
    padding-left: 22px;
    line-height: 1.8;
}
.today-q {
    margin-top: 14px;
    padding: 10px 12px;
    border-radius: 12px;
    background: var(--brand-soft);
    color: var(--brand);
    font-weight: 700;
}
@media (max-width: 820px) {
    .today-wrap {
        grid-template-columns: 1fr;
        grid-template-rows: 55vh auto;
        height: auto;
    }
    .today-side {
        border-left: 0;
        border-top: 1px solid var(--line);
    }
    .qr-mini {
        width: 64px;
        height: 64px;
    }
}

/* ===== 2차시 도입: 조별 예측 ===== */
#btn-predict.pulse {
    animation: pulse 1.6s ease-in-out infinite;
    box-shadow: 0 0 0 0 rgba(109, 40, 217, 0.5);
}
@keyframes pulse {
    0%,
    100% {
        box-shadow: 0 0 0 0 rgba(109, 40, 217, 0.45);
    }
    50% {
        box-shadow: 0 0 0 10px rgba(109, 40, 217, 0);
    }
}
.pred-edit {
    padding: 14px 16px;
    margin-bottom: 18px;
    border-radius: 16px;
    background: #f5f3ff;
    border: 1px solid #ddd6fe;
}
.pred-edit h3 {
    margin: 0 0 4px;
    font-size: 18px;
}
.pred-edit h3 b {
    color: var(--violet);
}
.pred-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 10px 0 12px;
    max-height: 240px;
    overflow: auto;
}
.pred-chip {
    padding: 6px 12px;
    border-radius: 999px;
    border: 1.5px solid var(--line);
    background: #fff;
    font: inherit;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    cursor: pointer;
}
.pred-chip small {
    margin-left: 4px;
    color: var(--ink-3);
    font-weight: 600;
}
.pred-chip.on {
    border-color: var(--violet);
    background: var(--violet);
    color: #fff;
}
.pred-chip.on small {
    color: #ddd6fe;
}
.pred-reason-label {
    display: flex;
    flex-direction: column;
    gap: 4px;
    font-weight: 700;
}
.pred-reason-label textarea {
    font: inherit;
    padding: 8px 10px;
    border-radius: 10px;
    border: 1px solid var(--line);
    resize: vertical;
}
.pred-edit .row-end {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 12px;
    margin-top: 10px;
}
.pred-board-head {
    font-size: 18px;
    margin: 0 0 10px;
}
.pred-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 10px;
}
.pred-board.compact .pred-grid {
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.pred-card {
    padding: 12px 14px;
    border-radius: 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
}
.pred-card.mine {
    border-color: var(--violet);
    background: #faf5ff;
}
.pred-card h4 {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 0 6px;
    font-size: 17px;
}
.pred-score {
    margin-left: auto;
    padding: 1px 8px;
    border-radius: 999px;
    background: var(--violet);
    color: #fff;
    font-size: 12px;
}
.pred-list {
    margin: 0;
    padding: 0;
    list-style: none;
}
.pred-list li {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 0;
    border-bottom: 1px dashed var(--line);
    font-weight: 700;
}
.pv {
    flex: none;
    padding: 0 8px;
    border-radius: 999px;
    font-size: 13px;
    line-height: 22px;
}
.pv-hit {
    background: #fee2e2;
    color: #b91c1c;
}
.pv-half {
    background: #fef3c7;
    color: #92400e;
}
.pv-miss {
    background: #dcfce7;
    color: #166534;
}
.pv-unknown {
    background: #f1f5f9;
    color: #64748b;
}
.pred-why {
    margin: 8px 0 0;
    font-size: 14px;
    color: var(--ink-2);
}
.pred-actual {
    margin: 14px 0 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: #fff7ed;
    color: #7c2d12;
}

/* ===== 갤러리 워크 ===== */
.rate-progress {
    padding: 4px 12px;
    border-radius: 999px;
    background: #fef3c7;
    color: #92400e;
    font-weight: 900;
}
.rate-progress.done {
    background: #dcfce7;
    color: #166534;
}
.present.single .present-nav {
    visibility: hidden;
}
