:root {
    --em-600: #059669;
    --em-500: #10b981;
    --em-700: #047857;
    --em-50: #ecfdf5;
    --em-100: #d1fae5;
    --teal-600: #0d9488;
    --gray-50: #f9fafb;
    --gray-100: #f3f4f6;
    --gray-200: #e5e7eb;
    --gray-300: #d1d5db;
    --gray-400: #9ca3af;
    --gray-500: #6b7280;
    --gray-600: #4b5563;
    --gray-700: #374151;
    --gray-800: #1f2937;
    --gray-900: #111827;
    --white: #ffffff;
    --red-50: #fef2f2;
    --red-600: #dc2626;
    --red-700: #b91c1c;
    --blue-50: #eff6ff;
    --blue-600: #2563eb;
    --amber-50: #fffbeb;
    --amber-600: #d97706;
    --bb-max: 400px;
    --radius-lg: 0.5rem;
    --radius-xl: 0.75rem;
    --radius-2xl: 1rem;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    min-height: 100%;
    font-family: "Noto Sans KR", system-ui, -apple-system, sans-serif;
    background: var(--gray-200);
    color: var(--gray-800);
    -webkit-tap-highlight-color: transparent;
}

body {
    display: flex;
    justify-content: center;
    align-items: stretch;
    min-height: 100dvh;
    margin: 0;
    padding: 0;
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select { font-family: inherit; }

/* ——— Shell ——— */
.app-shell {
    width: 100%;
    max-width: var(--bb-max);
    min-height: 100dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    background: var(--white);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    position: relative;
}

@media (min-width: 431px) {
    body {
        align-items: center;
        padding: 1.5rem 0;
        background: var(--gray-200);
    }

    .app-shell {
        min-height: min(100dvh, 800px);
        max-height: 800px;
        border-radius: 1.5rem;
        border: 1px solid var(--gray-200);
    }
}

/* ——— Top bar ——— */
.top-bar {
    background: var(--white);
    border-bottom: 1px solid var(--gray-100);
    padding: 1.25rem 1.25rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    z-index: 2;
    flex-shrink: 0;
}

.title {
    flex: 1;
    text-align: center;
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--gray-800);
    line-height: 1;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
}

.top-spacer { width: 76px; flex-shrink: 0; }

.top-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.top-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: auto;
    min-height: 36px;
    padding: 0.4rem 0.9rem;
    border-radius: var(--radius-lg);
    background: var(--em-600);
    border: none;
    color: var(--white);
    font-size: 0.8125rem;
    font-weight: 700;
    white-space: nowrap;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease, transform 0.12s ease;
}

.top-action:hover { background: var(--em-700); }
.top-action:active { transform: scale(0.97); }

.top-action-bbs {
    background: #fff !important;
    color: #111 !important;
    border: 1px solid var(--gray-200) !important;
    box-shadow: var(--shadow-sm);
    min-width: auto;
    padding: 0.2rem 0.65rem 0.35rem;
}

.top-action-bbs:hover {
    background: #fff !important;
    color: #111 !important;
    border-color: var(--gray-300) !important;
}

.top-action-bbs .bbs-logo-text {
    font-family: "Pacifico", cursive !important;
    font-size: 1.2rem;
    font-weight: 400 !important;
    letter-spacing: 0.01em;
    line-height: 1;
    color: #111;
}

.days-form {
    margin: 0;
    flex-shrink: 0;
}

.days-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.6rem;
    min-height: 2rem;
    padding: 0.3rem 0.65rem;
    border: 1px solid var(--em-100);
    border-radius: 999px;
    background: var(--em-50);
    color: var(--em-700);
    font-size: 0.8rem;
    font-weight: 800;
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.15s ease, transform 0.12s ease;
}

.days-btn:hover { background: var(--em-100); }
.days-btn:active { transform: scale(0.96); }

/* ——— Stage / content ——— */
.stage {
    position: relative;
    overflow: auto;
    padding: 1.25rem;
    background: var(--gray-50);
    min-height: 0;
}

.content {
    position: relative;
    z-index: 1;
    padding-bottom: 0.5rem;
}

.message {
    margin-bottom: 0.9rem;
    padding: 0.75rem 0.9rem;
    background: var(--em-50);
    color: var(--em-700);
    border: 1px solid var(--em-100);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    font-size: 0.875rem;
    font-weight: 600;
}

.message.error {
    background: var(--red-50);
    color: var(--red-700);
    border-color: #fecaca;
}

/* ——— Filter tabs ——— */
.filter-tabs {
    display: flex;
    background: var(--white);
    border-bottom: 1px solid var(--gray-200);
    margin: -1.25rem -1.25rem 1rem;
    position: sticky;
    top: -1.25rem;
    z-index: 10;
}

.filter-tab {
    flex: 1;
    display: grid;
    place-items: center;
    min-height: 48px;
    padding: 1rem 0.5rem;
    border: none;
    border-bottom: 3px solid transparent;
    border-radius: 0;
    background: var(--white);
    color: var(--gray-400);
    font-size: 0.875rem;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease;
    box-shadow: none;
}

.filter-tab.active {
    color: var(--em-600);
    border-bottom-color: var(--em-600);
    background: var(--white);
    box-shadow: none;
}

/* ——— Room list / cards ——— */
.room-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.room-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    color: var(--gray-800);
    transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

a.room-card-link {
    display: block;
    text-decoration: none;
    color: inherit;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    cursor: pointer;
}

a.room-card-link:hover .room-card,
a.room-card-link:hover {
    border-color: var(--gray-200);
    box-shadow: var(--shadow);
}

a.room-card-link:active {
    transform: scale(0.99);
}

.room-card-top {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0.7rem;
    padding: 0.9rem 1rem 0.6rem;
    align-items: start;
}

.room-badge {
    min-width: 52px;
    padding: 0.3rem 0.45rem;
    border-radius: var(--radius-lg);
    text-align: center;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--white);
    border: none;
    box-shadow: none;
}

.room-badge.recruiting { background: var(--em-600); }
.room-badge.running { background: var(--blue-600); }
.room-badge.ended { background: var(--gray-500); }

.room-main h2 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    line-height: 1.3;
    word-break: keep-all;
}

.room-main .desc {
    margin-top: 0.25rem;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--gray-500);
    line-height: 1.4;
}

.room-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.7rem;
    margin-top: 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-500);
}

.room-meta span {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.lock-tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    background: var(--amber-50);
    border: 1px solid #fde68a;
    color: var(--amber-600);
    font-size: 0.7rem;
    font-weight: 700;
}

.role-tag {
    display: inline-block;
    padding: 0.1rem 0.45rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.7rem;
    font-weight: 700;
}

.role-tag.owner {
    background: var(--em-50);
    border-color: var(--em-100);
    color: var(--em-700);
}

.role-tag.member {
    background: var(--blue-50);
    border-color: #bfdbfe;
    color: var(--blue-600);
}

.role-tag.ready {
    background: var(--em-50);
    border-color: var(--em-100);
    color: var(--em-600);
}

.role-tag.wait {
    background: var(--gray-100);
    border-color: var(--gray-200);
    color: var(--gray-500);
}

.room-card-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.7rem 1rem;
    background: var(--gray-50);
    border-top: 1px solid var(--gray-100);
    flex-wrap: wrap;
}

.join-form {
    flex: 1;
    min-width: 180px;
}

.room-card-bottom .owner {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-500);
    text-shadow: none;
}

.my-actions {
    align-items: center;
}

.action-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    justify-content: flex-end;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    min-height: 40px;
    padding: 0.45rem 0.9rem;
    border-radius: var(--radius-xl);
    border: none;
    background: var(--em-600);
    color: var(--white);
    font-size: 0.875rem;
    font-weight: 700;
    text-shadow: none;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}

.action-btn:hover { background: var(--em-700); }
.action-btn:active { transform: scale(0.97); }

.action-btn:disabled,
.action-btn.disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
}

.action-btn.joined {
    background: var(--gray-100);
    color: var(--gray-700);
    border: 1px solid var(--gray-200);
    box-shadow: none;
}

.action-btn.leave {
    background: var(--red-600);
    border: none;
    box-shadow: var(--shadow-sm);
}

.action-btn.leave:hover { background: var(--red-700); }
.action-btn.leave:active { box-shadow: var(--shadow-sm); }

.password-row {
    display: flex;
    gap: 0.4rem;
    width: 100%;
}

.password-row input {
    flex: 1;
    min-width: 0;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 0.45rem 0.6rem;
    font-size: 0.875rem;
    font-weight: 600;
    background: var(--white);
    color: var(--gray-800);
    outline: none;
}

.password-row input:focus {
    border-color: var(--em-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.empty-box {
    text-align: center;
    padding: 2rem 1.25rem;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
}

.empty-box p {
    color: var(--gray-400);
    font-weight: 500;
    font-size: 0.875rem;
    margin-bottom: 0.9rem;
}

.create-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem 1.25rem;
    border-radius: var(--radius-xl);
    background: var(--em-600);
    border: none;
    color: var(--white);
    box-shadow: var(--shadow-sm);
    font-weight: 700;
    font-size: 0.875rem;
    transition: background 0.15s ease;
}

.create-link:hover { background: var(--em-700); }

/* ——— Detail ——— */
.detail-card {
    margin-bottom: 0.9rem;
    padding: 0 !important;
    overflow: hidden;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
}

.detail-card-summary {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.65rem;
    width: 100%;
    padding: 0.9rem 1rem;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.detail-title-line {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.room-chevron {
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--gray-400);
    border-bottom: 2px solid var(--gray-400);
    transform: rotate(45deg);
    transition: transform 0.2s ease;
    flex-shrink: 0;
    margin-top: -4px;
}

.detail-card-expandable.is-open .room-chevron {
    transform: rotate(-135deg);
    margin-top: 4px;
}

.detail-card-body {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.25s ease;
}

.detail-card-expandable.is-open .detail-card-body {
    grid-template-rows: 1fr;
}

.detail-card-body-inner {
    overflow: hidden;
    min-height: 0;
    padding: 0 1rem;
    opacity: 0;
    transition: opacity 0.2s ease, padding 0.25s ease;
}

.detail-card-expandable.is-open .detail-card-body-inner {
    padding: 0 1rem 1rem;
    opacity: 1;
}

.detail-badge-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.55rem;
}

.detail-badge-row:empty { display: none; }

.detail-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.detail-title::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 16px;
    background: var(--em-500);
    border-radius: 999px;
    flex-shrink: 0;
}

.detail-desc {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--gray-500);
    line-height: 1.45;
    margin-bottom: 0.7rem;
}

.detail-actions {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 0.7rem;
}

.detail-link-btn {
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0.55rem 1rem;
    border-radius: var(--radius-xl);
    background: var(--em-600);
    color: var(--white);
    font-weight: 700;
    font-size: 0.875rem;
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease;
}

.detail-link-btn:hover { background: var(--em-700); }

.detail-note {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.8125rem;
    font-weight: 500;
}

/* ——— Rank board (cards) ——— */
.rank-board {
    margin: 0.2rem 0 1rem;
}

.rank-empty {
    text-align: center;
    color: var(--gray-400);
    font-size: 0.875rem;
    font-weight: 500;
    padding: 1.2rem 0.5rem;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
}

.rank-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

.rank-slot {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 0;
}

.rank-kick-form {
    margin: 0;
}

.rank-kick-btn {
    width: 100%;
    border: 1px solid #fecaca;
    border-radius: 999px;
    background: #fff;
    color: #b91c1c;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 800;
    padding: 0.38rem 0.5rem;
    cursor: pointer;
}

.rank-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.45rem;
    padding: 0.95rem 0.9rem;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    color: var(--gray-800);
    text-decoration: none;
    min-height: 7.6rem;
    transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.rank-card:active {
    transform: scale(0.98);
    background: var(--gray-50);
}

.rank-card.is-me {
    border-color: var(--em-100);
    background: var(--em-50);
}

.rank-top {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.rank-medal {
    font-size: 1.85rem;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    min-height: 2rem;
}

.rank-no {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--gray-100);
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--gray-600);
}

.rank-name {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    line-height: 1.25;
}

.rank-change {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.2rem 0.28rem;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--gray-500);
    line-height: 1.2;
    width: 100%;
}

.rank-change-arrow {
    color: var(--gray-300);
    font-weight: 800;
}

.rank-change-after {
    color: var(--gray-800);
}

.rank-score {
    margin-top: auto;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.35rem;
    width: 100%;
    white-space: nowrap;
}

.rank-score-label {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-400);
}

.rank-score-value {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--em-600);
}

.rank-score-plain {
    font-size: 0.92rem;
    font-weight: 800;
    color: var(--gray-500);
    justify-content: flex-start;
}

/* ——— FAB ——— */
.detail-fab {
    position: absolute;
    right: 0.9rem;
    bottom: calc(4.6rem + env(safe-area-inset-bottom));
    z-index: 100;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    pointer-events: none;
}

.detail-fab-btn {
    width: 52px;
    height: 52px;
    border-radius: var(--radius-xl);
    display: grid;
    place-items: center;
    text-decoration: none;
    border: none;
    background: var(--em-600);
    box-shadow: var(--shadow);
    color: var(--white);
    transition: background 0.15s ease, transform 0.12s ease;
    pointer-events: auto;
}

.detail-fab-btn:hover { background: var(--em-700); }
.detail-fab-btn:active { transform: scale(0.95); }

.detail-fab-btn svg {
    width: 24px;
    height: 24px;
    display: block;
}

.detail-fab-btn.chat {
    background: var(--teal-600);
}

.detail-fab-btn.chat:hover { background: #0f766e; }

/* ——— Forms ——— */
.create-form {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.profile-password-form {
    margin-top: 1.25rem;
}

.form-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    padding: 1.25rem;
    color: var(--gray-800);
}

.field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.85rem;
}

.field:last-child { margin-bottom: 0; }

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.field-row .field { margin-bottom: 0; }

.field .label {
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--gray-700);
}

.field input,
.field textarea,
.field select {
    width: 100%;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-lg);
    padding: 0.65rem 0.75rem;
    font-size: 0.9375rem;
    font-weight: 600;
    background: var(--white);
    color: var(--gray-800);
    outline: none;
    resize: vertical;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
    border-color: var(--em-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.check-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin-bottom: 0.85rem;
    font-size: 0.875rem;
    font-weight: 700;
    color: var(--gray-700);
}

.check-row input {
    width: 18px;
    height: 18px;
    accent-color: var(--em-600);
}

.password-field.hidden { display: none; }

.submit-btn {
    width: 100%;
    min-height: 56px;
    padding: 1rem;
    border-radius: var(--radius-xl);
    border: none;
    background: var(--gray-900);
    color: var(--white);
    font-size: 1.125rem;
    font-weight: 700;
    text-shadow: none;
    box-shadow: var(--shadow-lg);
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
}

.submit-btn:hover { background: var(--gray-800); }
.submit-btn:active { transform: scale(0.98); }
.submit-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.cancel-link {
    display: block;
    text-align: center;
    color: var(--gray-500);
    font-weight: 600;
    font-size: 0.875rem;
    padding: 0.4rem;
    transition: color 0.15s ease;
}

.cancel-link:hover { color: var(--em-600); }

/* ——— Profile extras (kept for PHP pages) ——— */
.profile-hero {
    text-align: center;
    margin-bottom: 0.9rem;
}

.avatar-wrap {
    display: inline-block;
    padding: 3px;
    border-radius: 50%;
    background: var(--em-100);
    box-shadow: var(--shadow-sm);
    margin-bottom: 0.7rem;
}

.avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--white);
    display: block;
    background: var(--gray-100);
}

.avatar-char {
    width: 72px;
    height: 72px;
    border-radius: 0.85rem;
    object-fit: contain;
    background-color: var(--em-50);
}

.char-sprite {
    display: block;
    background-image: url('../../images/char/total.png');
    background-repeat: no-repeat;
    background-size: 600% 300%;
    background-position: 0% 0%;
    image-rendering: auto;
    /* 스프라이트 셀 경계(옆 어깨 등) 부드럽게 가림 */
    -webkit-mask-image:
        linear-gradient(to right, transparent 0%, #000 14%, #000 86%, transparent 100%),
        linear-gradient(to bottom, transparent 0%, #000 10%, #000 90%, transparent 100%);
    -webkit-mask-composite: source-in;
    mask-image:
        linear-gradient(to right, transparent 0%, #000 14%, #000 86%, transparent 100%),
        linear-gradient(to bottom, transparent 0%, #000 10%, #000 90%, transparent 100%);
    mask-composite: intersect;
}

.avatar-fallback {
    display: grid;
    place-items: center;
    background: var(--em-600);
    color: var(--white);
    font-size: 2rem;
    font-weight: 700;
}

.profile-name {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--gray-800);
    text-shadow: none;
}

.profile-email {
    margin-top: 0.25rem;
    color: var(--gray-400);
    font-size: 0.85rem;
    font-weight: 500;
}

.char-picker-hint {
    margin: 0.2rem 0 0.5rem;
    font-size: 0.75rem;
    color: var(--gray-400);
    font-weight: 500;
    line-height: 1.35;
}

.char-picker {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.4rem;
}

.char-option {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0;
    padding: 0.25rem;
    border: 2px solid var(--gray-100);
    border-radius: var(--radius-lg);
    background: var(--gray-50);
    cursor: pointer;
    transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.char-option input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.char-option img,
.char-option-sprite {
    width: 56px;
    height: 56px;
    object-fit: contain;
    display: block;
}

.char-option.is-selected,
.char-option:has(input:checked) {
    border-color: var(--em-600);
    background: var(--em-50);
    box-shadow: 0 0 0 2px rgba(5, 150, 105, 0.18);
}

.char-option-photo-img {
    width: 56px;
    height: 56px;
    object-fit: cover;
    border-radius: 0.45rem;
    display: block;
}

.char-option-wrap {
    position: relative;
}

.char-del-btn {
    position: absolute;
    top: -0.3rem;
    right: -0.3rem;
    z-index: 2;
    width: 1.35rem;
    height: 1.35rem;
    padding: 0;
    border: none;
    border-radius: 50%;
    background: var(--red-600);
    color: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}

.char-del-btn:hover {
    background: var(--red-700);
}

.char-add-btn {
    width: 100%;
    margin-top: 0.55rem;
    min-height: 42px;
    padding: 0.55rem 1rem;
    font-size: 0.9rem;
    background: var(--em-600);
    box-shadow: var(--shadow-sm);
}

.char-add-btn:hover {
    background: var(--em-700);
}

.stat-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.9rem;
}

.stat-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    padding: 0.85rem 0.5rem;
    text-align: center;
}

.stat-card strong {
    display: block;
    font-size: 1.4rem;
    color: var(--em-600);
    line-height: 1.1;
}

.stat-card span {
    display: block;
    margin-top: 0.25rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-400);
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0;
    border-top: 1px solid var(--gray-100);
}

.info-row .label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-700);
}

.info-row .value {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-500);
    text-align: right;
    word-break: break-all;
}

.session-panel {
    margin-top: 0.9rem;
    padding: 1rem;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
}

.session-panel h3 {
    font-size: 0.9375rem;
    margin-bottom: 0.6rem;
    color: var(--gray-800);
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.session-panel h3::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 16px;
    background: var(--em-500);
    border-radius: 999px;
    flex-shrink: 0;
}

.session-actions {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
}

.pill-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 42px;
    padding: 0.5rem 1rem;
    border-radius: var(--radius-xl);
    font-size: 0.875rem;
    font-weight: 700;
    border: none;
    cursor: pointer;
    transition: background 0.15s ease, transform 0.12s ease;
    box-shadow: var(--shadow-sm);
}

.pill-btn:active { transform: scale(0.97); }

.pill-btn.extend {
    background: var(--em-600);
    color: var(--white);
}

.pill-btn.extend:hover { background: var(--em-700); }
.pill-btn.extend:active { box-shadow: var(--shadow-sm); }

.pill-btn.logout {
    background: var(--red-600);
    color: var(--white);
}

.pill-btn.logout:hover { background: var(--red-700); }
.pill-btn.logout:active { box-shadow: var(--shadow-sm); }

.room-status-line {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.85rem;
}

.muted-text {
    color: var(--gray-400);
    font-size: 0.85rem;
    font-weight: 500;
}

.owner-controls {
    display: flex;
    gap: 0.55rem;
    flex-wrap: wrap;
    margin-top: 0.2rem;
}

.report-summary h2 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 0.35rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.report-summary h2::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 16px;
    background: var(--em-500);
    border-radius: 999px;
    flex-shrink: 0;
}

.report-block {
    margin-bottom: 1rem;
}

.report-block .section-head,
.section-head {
    margin-bottom: 0.55rem;
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--gray-800);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.section-head::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 16px;
    background: var(--em-500);
    border-radius: 999px;
    flex-shrink: 0;
}

.bbstar-entry {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    padding: 0.9rem 1rem;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    color: inherit;
}

.bbstar-entry:active {
    transform: scale(0.99);
}

.bbstar-entry-title {
    font-size: 1rem;
    font-weight: 800;
    color: #ea580c;
    letter-spacing: -0.02em;
}

.bbstar-entry-desc {
    flex: 1;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--gray-400);
}

.bbstar-entry-go {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--gray-400);
}

.file-status {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--gray-500);
    margin-bottom: 0.45rem;
}

.file-status.ok {
    color: var(--em-600);
}

.file-link {
    display: inline-flex;
    margin-bottom: 0.75rem;
    color: var(--em-600);
    font-weight: 700;
    text-decoration: underline;
}

.upload-form .submit-btn-ai {
    margin-top: 0.35rem;
    min-height: 40px;
    padding: 0.65rem 0.75rem;
    font-size: 0.9rem;
    border-radius: var(--radius-lg);
    background: #059669;
    box-shadow: var(--shadow-sm);
}

.upload-hint {
    margin: 0.35rem 0 0.55rem;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-400);
    line-height: 1.4;
}

.upload-form .submit-btn-ai:hover {
    background: #047857;
}

.upload-form.is-uploading .submit-btn-ai,
.upload-form .submit-btn-ai:disabled {
    opacity: 0.72;
    cursor: wait;
    background: #047857;
}

.upload-busy {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0.75rem 0 0;
    padding: 0.7rem 0.8rem;
    border-radius: var(--radius-lg);
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    color: #065f46;
    font-size: 0.82rem;
    font-weight: 600;
    line-height: 1.4;
}

.upload-busy[hidden] {
    display: none;
}

.upload-busy-spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid #a7f3d0;
    border-top-color: #059669;
    border-radius: 50%;
    flex-shrink: 0;
    animation: uploadSpin 0.7s linear infinite;
}

@keyframes uploadSpin {
    to { transform: rotate(360deg); }
}

.report-chart-card {
    padding: 0.85rem 0.75rem 0.55rem;
}

.report-chart-card canvas {
    width: 100% !important;
    height: 220px !important;
    display: block;
}

.rank-race-block {
    margin-bottom: 0.85rem;
}

.rank-race-card {
    padding: 0.85rem 0.85rem 0.7rem;
}

.ceremony-card {
    padding: 1rem 0.85rem 0.85rem;
    margin-bottom: 0.65rem;
    overflow: hidden;
    max-height: 280px;
    opacity: 1;
    transform-origin: top center;
    transition:
        max-height 0.5s ease,
        opacity 0.35s ease,
        padding 0.4s ease,
        margin 0.4s ease,
        border-width 0.3s ease;
}

.ceremony-card.is-collapsed {
    max-height: 0;
    opacity: 0;
    padding-top: 0;
    padding-bottom: 0;
    margin-bottom: 0;
    border-width: 0;
    pointer-events: none;
}

.ceremony-podium {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    min-height: 148px;
    padding: 0.35rem 0.5rem 0.15rem;
    gap: 0;
}

.ceremony-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    text-align: center;
    flex: 0 0 auto;
    width: 32%;
    max-width: 118px;
}

.ceremony-slot.is-silver {
    z-index: 1;
    margin-right: -3%;
}

.ceremony-slot.is-bronze {
    z-index: 1;
    margin-left: -3%;
}

.ceremony-slot.is-gold {
    z-index: 3;
    width: 38%;
    max-width: 136px;
}

.ceremony-figure {
    display: flex;
    align-items: flex-end;
    justify-content: center;
    width: 100%;
    height: 104px;
    transition: opacity 0.22s ease;
}

.ceremony-slot.is-gold .ceremony-figure {
    height: 128px;
}

.ceremony-name {
    position: relative;
    z-index: 4;
    margin-top: 0.3rem;
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-700);
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 0.15rem;
    transition: opacity 0.22s ease;
}

.ceremony-slot.is-fading .ceremony-figure,
.ceremony-slot.is-fading .ceremony-name {
    opacity: 0;
}

.ceremony-char {
    width: 88px;
    height: 88px;
    display: block;
    align-self: flex-end;
    filter: drop-shadow(0 3px 6px rgba(15, 23, 42, 0.2));
}

.ceremony-char-photo {
    object-fit: cover;
    border-radius: 50%;
    background: #fff;
}

.ceremony-slot.is-gold .ceremony-char {
    width: 112px;
    height: 112px;
    transform: translateY(3px);
    filter: drop-shadow(0 5px 10px rgba(15, 23, 42, 0.26));
}

.ceremony-fallback {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    align-self: flex-end;
    background: var(--gray-200);
    color: var(--gray-500);
    font-weight: 800;
    font-size: 1.1rem;
}

.ceremony-slot.is-gold .ceremony-fallback {
    width: 72px;
    height: 72px;
    font-size: 1.3rem;
    background: #fef3c7;
    color: #b45309;
}

.ceremony-slot.is-gold .ceremony-name {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--gray-800);
}

.ceremony-slot.is-empty {
    opacity: 0.45;
}

.podium-stage {
    display: none;
}

.podium-stands {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    display: grid;
    grid-template-columns: 1fr 1.15fr 1fr;
    align-items: end;
    gap: 0.35rem;
    z-index: 1;
}

.podium-stand {
    width: 100%;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.35rem;
    border-radius: 0.35rem 0.35rem 0.1rem 0.1rem;
    font-size: 0.85rem;
    font-weight: 900;
    color: rgba(255, 255, 255, 0.95);
}

.podium-stand.is-gold {
    height: 58px;
    background: linear-gradient(180deg, #fbbf24 0%, #d97706 100%);
}

.podium-stand.is-silver {
    height: 42px;
    background: linear-gradient(180deg, #cbd5e1 0%, #64748b 100%);
}

.podium-stand.is-bronze {
    height: 30px;
    background: linear-gradient(180deg, #fdba74 0%, #c2410c 100%);
}

.podium-racers {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    bottom: 0;
    z-index: 2;
    pointer-events: none;
}

.podium-racer {
    position: absolute;
    left: 50%;
    bottom: 42px;
    width: 32%;
    display: flex;
    flex-direction: column;
    align-items: center;
    transform: translate3d(-50%, 0, 0);
    transition: left 0.55s cubic-bezier(0.22, 1.45, 0.36, 1),
                bottom 0.55s cubic-bezier(0.22, 1.45, 0.36, 1);
    will-change: left, bottom;
}

.podium-racer.is-bump .podium-animal {
    animation: podiumBump 0.45s ease;
}

.podium-racer.is-gold-place .podium-animal {
    transform: scale(1.08);
}

.podium-racer .podium-char {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.podium-medal {
    position: absolute;
    top: 2px;
    right: 4px;
    font-size: 1.15rem;
    line-height: 1;
    z-index: 2;
    filter: drop-shadow(0 1px 1px rgba(0,0,0,0.15));
}

.podium-animal {
    line-height: 0;
    transform-origin: center bottom;
    transition: transform 0.35s ease;
}

.podium-chest-name {
    position: absolute;
    left: 50%;
    bottom: 10px;
    transform: translateX(-50%);
    z-index: 3;
    max-width: 4.6rem;
    padding: 0.12rem 0.28rem;
    border-radius: 0.35rem;
    background: rgba(255, 255, 255, 0.94);
    border: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    font-size: 0.62rem;
    font-weight: 800;
    color: var(--gray-800);
    line-height: 1.15;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.podium-racer.is-gold-place .podium-chest-name {
    bottom: 12px;
    max-width: 5rem;
    font-size: 0.66rem;
    background: #fffbeb;
    border-color: #fde68a;
}

@keyframes podiumBump {
    0% { transform: translateX(0) scale(1); }
    25% { transform: translateX(-5px) scale(1.04) rotate(-3deg); }
    55% { transform: translateX(5px) scale(1.05) rotate(3deg); }
    100% { transform: translateX(0) scale(1) rotate(0deg); }
}

.rank-race-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-direction: row-reverse;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.rank-race-date {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--gray-800);
    letter-spacing: -0.02em;
    transition: color 0.25s ease, transform 0.25s ease;
    transform-origin: right center;
}

.rank-race-date.is-pop {
    animation: rankRaceDatePop 0.22s ease;
}

@keyframes rankRaceDatePop {
    0% { transform: scale(1); }
    40% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

.rank-race-actions {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.rank-race-btn {
    min-width: 2rem;
    height: 2rem;
    padding: 0 0.55rem;
    border: 1px solid var(--gray-200);
    border-radius: 999px;
    background: var(--white);
    color: var(--gray-700);
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
}

.rank-race-btn.rank-race-play {
    min-width: 4.2rem;
    background: var(--em-50);
    border-color: var(--em-100);
    color: var(--em-700);
}

.rank-race-btn.rank-race-play.is-playing {
    background: var(--gray-900);
    border-color: var(--gray-900);
    color: var(--white);
}

.rank-race-track {
    position: relative;
    width: 100%;
}

.rank-race-track.is-race {
    overflow: hidden;
}

.rank-race-row {
    position: absolute;
    left: 0;
    right: 0;
    top: 0;
    display: grid;
    grid-template-columns: 6.4rem 1fr;
    gap: 0.45rem;
    align-items: center;
    height: 36px;
    will-change: transform;
    transition: none;
}

.rank-race-meta {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    min-width: 0;
}

.rank-race-place {
    flex-shrink: 0;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--gray-600);
    min-width: 1.7rem;
}

.rank-race-name {
    font-size: 0.8rem;
    font-weight: 800;
    color: var(--gray-800);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rank-race-bar-wrap {
    position: relative;
    height: 1.45rem;
    border-radius: 0;
    background: var(--gray-50);
    overflow: hidden;
}

.rank-race-bar {
    height: 100%;
    border-radius: 0;
    min-width: 0.35rem;
    width: 0%;
    opacity: 0.92;
    will-change: width;
}

.rank-race-val {
    position: absolute;
    right: 0.55rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.72rem;
    font-weight: 800;
    color: var(--gray-800);
    text-shadow:
        1px 0 0 rgba(255, 255, 255, 0.95),
        -1px 0 0 rgba(255, 255, 255, 0.95),
        0 1px 0 rgba(255, 255, 255, 0.95),
        0 -1px 0 rgba(255, 255, 255, 0.95);
    pointer-events: none;
}

.rank-history-block {
    margin-bottom: 0.85rem;
}

.rank-history-block .report-chart-card {
    padding-top: 1rem;
    padding-bottom: 0.75rem;
}

.rank-history-block .report-chart-card canvas {
    height: 240px !important;
}

.rank-chart-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.65rem;
    padding-top: 0.55rem;
    border-top: 1px solid var(--gray-100);
}

.rank-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border-radius: 999px;
    border: 1px solid var(--gray-200);
    background: var(--gray-50);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--gray-700);
    cursor: pointer;
    transition: background 0.12s ease, color 0.12s ease, opacity 0.12s ease, border-color 0.12s ease;
}

.rank-legend-item.is-on {
    background: var(--white);
    border-color: var(--gray-200);
    color: var(--gray-800);
}

.rank-legend-item.is-off {
    opacity: 0.45;
    color: var(--gray-400);
    background: transparent;
}

.rank-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--dot, var(--em-500));
    flex-shrink: 0;
}

.rank-legend-item.is-off .rank-legend-dot {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--dot, var(--gray-400));
}

.rank-legend-all.is-on {
    background: var(--em-500);
    border-color: var(--em-500);
    color: #fff;
}

.upload-history {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.upload-history-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    padding: 0.75rem 0.9rem;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
    -webkit-user-select: none;
    user-select: none;
    touch-action: manipulation;
}

.upload-history-row.is-deletable {
    cursor: pointer;
}

.upload-history-row.is-holding {
    background: #fef2f2;
    border-color: #fecaca;
    transform: scale(0.985);
}

.upload-history-row.is-longpress {
    background: #fee2e2;
    border-color: #f87171;
}

.upload-history-main {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}

.upload-history-fat {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
}

.upload-history-time {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--gray-400);
}

.upload-history-file {
    flex-shrink: 0;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--em-600);
    text-decoration: underline;
}

.room-title-link {
    color: inherit;
    text-decoration: none;
}

.room-title-link:active { opacity: 0.8; }

/* ——— Chat ——— */
.chat-shell {
    max-width: 100%;
    width: 100%;
}

body:has(.chat-shell) {
    display: flex;
    justify-content: center;
    background: var(--gray-200);
}

.chat-stage {
    display: flex;
}

.chat-content {
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: none;
    height: calc(100dvh - 150px);
    min-height: 420px;
}

.chat-room-head {
    margin-bottom: 0.55rem;
}

.chat-room-head h2 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--gray-800);
    text-shadow: none;
}

.chat-room-head p {
    margin-top: 0.2rem;
    color: var(--gray-400);
    font-size: 0.8rem;
    font-weight: 500;
}

.chat-status {
    margin-bottom: 0.45rem;
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--em-600);
}

.chat-status.error {
    color: var(--red-600);
}

.chat-log {
    flex: 1;
    overflow: auto;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
    padding: 0.75rem;
    box-shadow: var(--shadow-sm);
}

.chat-bubble {
    max-width: 85%;
    margin-bottom: 0.55rem;
    padding: 0.55rem 0.75rem;
    border-radius: var(--radius-xl);
    background: var(--gray-50);
    color: var(--gray-800);
    border: 1px solid var(--gray-100);
}

.chat-bubble.mine {
    margin-left: auto;
    background: var(--em-50);
    border-color: var(--em-100);
    color: var(--gray-800);
}

.chat-bubble.system {
    margin: 0.35rem auto 0.55rem;
    max-width: 95%;
    text-align: center;
    background: transparent;
    border: none;
    color: var(--gray-400);
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.2rem;
}

.chat-name {
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--gray-500);
    margin-bottom: 0.15rem;
}

.chat-text {
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.4;
    word-break: break-word;
}

.chat-form {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.45rem;
    margin-top: 0.65rem;
}

.chat-form input {
    border: 1px solid var(--gray-300);
    border-radius: var(--radius-xl);
    padding: 0.7rem 0.9rem;
    font-size: 0.9375rem;
    font-weight: 500;
    background: var(--white);
    color: var(--gray-800);
    outline: none;
}

.chat-form input:focus {
    border-color: var(--em-500);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
}

.chat-form .submit-btn,
.chat-form button[type="submit"] {
    min-height: 48px;
    min-width: 72px;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-xl);
    font-size: 0.9rem;
}

/* ——— Bottom nav ——— */
.bottom-bar {
    background: var(--white);
    border-top: 1px solid var(--gray-200);
    display: flex;
    justify-content: space-around;
    align-items: center;
    gap: 0.25rem;
    padding: 0.5rem 0.6rem calc(0.55rem + env(safe-area-inset-bottom));
    box-shadow: none;
    z-index: 20;
    flex-shrink: 0;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.2rem;
    flex: 1 1 0;
    max-width: 110px;
    min-height: 56px;
    border-radius: var(--radius-xl);
    color: var(--gray-400);
    font-size: 0.72rem;
    font-weight: 700;
    opacity: 1;
    border: none;
    background: transparent;
    transition: color 0.15s ease, background 0.15s ease;
}

.nav-item .ico {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: grid;
    place-items: center;
    background: var(--gray-100);
    border: none;
    box-shadow: none;
    position: relative;
    transition: background 0.15s ease;
}

.nav-item .ico::before {
    content: '';
    width: 10px;
    height: 10px;
    background: var(--gray-400);
    border-radius: 2px;
}

.nav-item[href="games.php"] .ico::before {
    width: 12px;
    height: 2px;
    box-shadow: 0 -4px 0 var(--gray-400), 0 4px 0 var(--gray-400);
    border-radius: 1px;
    background: var(--gray-400);
}

.nav-item[href="dashboard.php"] .ico::before {
    width: 12px;
    height: 8px;
    border-radius: 2px 2px 0 0;
    box-shadow: 0 6px 0 -2px var(--gray-400);
    background: var(--gray-400);
}

.nav-item[href="profile.php"] .ico::before {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    box-shadow: 0 7px 0 -1px var(--gray-400);
    background: var(--gray-400);
}

.nav-item.active {
    opacity: 1;
    background: var(--em-50);
    border: none;
    box-shadow: none;
    transform: none;
    color: var(--em-600);
}

.nav-item.active .ico {
    background: var(--em-100);
}

.nav-item.active .ico::before {
    background: var(--em-600);
}

.nav-item.active[href="games.php"] .ico::before {
    box-shadow: 0 -4px 0 var(--em-600), 0 4px 0 var(--em-600);
    background: var(--em-600);
}

.nav-item.active[href="dashboard.php"] .ico::before {
    box-shadow: 0 6px 0 -2px var(--em-600);
    background: var(--em-600);
}

.nav-item.active[href="profile.php"] .ico::before {
    box-shadow: 0 7px 0 -1px var(--em-600);
    background: var(--em-600);
}

/* ——— Dashboard ——— */
.hello {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 1rem;
}

.hello strong {
    color: var(--gray-800);
    font-weight: 800;
}

.menu-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}

.menu-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 1rem 1.1rem;
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    transition: background 0.15s ease, transform 0.12s ease;
}

.menu-card:active {
    transform: scale(0.98);
    background: var(--gray-50);
}

.menu-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: var(--em-50);
    border: 1px solid var(--em-100);
    display: grid;
    place-items: center;
    position: relative;
    flex-shrink: 0;
}

.menu-icon::before {
    content: '';
    display: block;
    background: var(--em-600);
}

.menu-icon.list::before {
    width: 16px;
    height: 2px;
    box-shadow: 0 -5px 0 var(--em-600), 0 5px 0 var(--em-600);
}

.menu-icon.create::before {
    width: 14px;
    height: 14px;
    border-radius: 3px;
    background: transparent;
    border: 2px solid var(--em-600);
    transform: rotate(45deg);
}

.menu-icon.profile::before {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    box-shadow: 0 9px 0 -2px var(--em-600);
}

.menu-text {
    flex: 1;
    min-width: 0;
}

.menu-text h2 {
    font-size: 0.95rem;
    font-weight: 800;
    color: var(--gray-800);
    margin-bottom: 0.15rem;
}

.menu-text p {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
}

.go-btn {
    font-size: 0.7rem;
    font-weight: 800;
    color: var(--em-700);
    background: var(--em-50);
    border: 1px solid var(--em-100);
    border-radius: 999px;
    padding: 0.35rem 0.65rem;
}

.session-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-sm);
    padding: 1.1rem;
}

.session-card h3 {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--gray-800);
    margin-bottom: 0.85rem;
}

.session-actions {
    display: flex;
    gap: 0.55rem;
}

.session-actions form {
    flex: 1;
}

.session-actions .pill-btn {
    width: 100%;
}

/* ——— Login ——— */
.login-shell .top-bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.15rem;
    padding-bottom: 1.1rem;
}

.login-shell .brand {
    font-size: 2.25rem;
    font-weight: 900;
    color: var(--em-600);
    letter-spacing: -0.04em;
    line-height: 1;
}

.login-shell .tagline {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--gray-500);
}

.login-panel {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: center;
    min-height: 60%;
    padding: 1.5rem 0;
    gap: 1rem;
}

.login-panel .hero-copy {
    font-size: 1rem;
    font-weight: 700;
    color: var(--gray-800);
    text-align: center;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.auth-form .field {
    margin-bottom: 0;
}

.auth-form .field input {
    min-height: 46px;
}

.auth-submit {
    margin-top: 0.2rem;
    min-height: 48px;
    font-size: 1rem;
}

.auth-links {
    text-align: center;
    font-size: 0.86rem;
    font-weight: 700;
}

.auth-links a {
    color: var(--em-600);
    text-decoration: underline;
}

.auth-links-dot {
    margin: 0 0.35rem;
    color: var(--gray-400);
    text-decoration: none;
}

.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
    padding: 0.25rem;
    border-radius: 999px;
    background: var(--gray-100);
}

.auth-tabs a {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 999px;
    font-size: 0.86rem;
    font-weight: 800;
    color: var(--gray-500);
    text-decoration: none;
}

.auth-tabs a.is-on {
    background: var(--white);
    color: var(--gray-800);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08);
}

.find-result {
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
}

.find-result-label {
    margin: 0 0 0.4rem;
    font-size: 0.78rem;
    font-weight: 800;
    color: var(--gray-500);
}

.find-result ul {
    margin: 0;
    padding: 0;
    list-style: none;
}

.find-result li {
    font-size: 1rem;
    font-weight: 800;
    color: var(--gray-800);
    letter-spacing: -0.02em;
}

.find-result li + li {
    margin-top: 0.25rem;
}

.find-result-note {
    margin: 0.55rem 0 0;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1.45;
    color: var(--gray-500);
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--gray-400);
    font-size: 0.78rem;
    font-weight: 700;
}

.auth-divider::before,
.auth-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--gray-200);
}

.kakao-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    min-height: 52px;
    padding: 0.9rem 1.2rem;
    border-radius: var(--radius-xl);
    background: #fee500;
    color: #191600;
    font-size: 1rem;
    font-weight: 800;
    box-shadow: var(--shadow-sm);
    transition: transform 0.12s ease, filter 0.12s ease;
}

.kakao-btn:active {
    transform: scale(0.98);
    filter: brightness(0.97);
}

.kakao-btn img {
    width: 22px;
    height: 22px;
}

.safe-note {
    text-align: center;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--gray-400);
}

.login-shell .bottom-bar {
    justify-content: center;
    gap: 0.45rem;
    min-height: 52px;
}

.dock-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--gray-300);
}

.dock-dot:nth-child(3) {
    background: var(--em-500);
    width: 18px;
    border-radius: 999px;
}

/* ——— bbstar (Instagram-like) ——— */
.ig-body {
    margin: 0;
    background: #000;
    display: block;
    align-items: stretch;
    padding: 0;
}

.ig-body .ig-shell {
    width: 100%;
    max-width: 430px;
    min-height: 100dvh;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    background: #fff;
    color: #0f172a;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06);
}

@media (min-width: 480px) {
    .ig-body {
        display: flex;
        align-items: stretch;
        justify-content: center;
        min-height: 100dvh;
        padding: 0;
        background: #0a0a0a;
    }

    .ig-body .ig-shell {
        min-height: 100dvh;
        max-height: 100dvh;
    }
}

.ig-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    min-height: 52px;
    padding: 0.45rem 0.65rem;
    border-bottom: 1px solid #efefef;
    background: #fff;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    z-index: 5;
}

.ig-logo {
    margin: 0;
    flex: 1;
    text-align: center;
    font-family: "Pacifico", cursive;
    font-size: 1.45rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    color: #111;
    line-height: 1;
}

.ig-title {
    margin: 0;
    flex: 1;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #111;
}

.ig-icon-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    color: #111;
    display: grid;
    place-items: center;
    border-radius: 0.6rem;
    cursor: pointer;
    padding: 0;
}

.ig-icon-btn:active {
    background: #f4f4f5;
}

.ig-text-btn {
    border: none;
    background: transparent;
    color: #111;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    padding: 0.4rem 0.55rem;
    cursor: pointer;
    min-width: 3.2rem;
}

.ig-text-btn.ig-share {
    color: #0095f6;
    font-weight: 700;
}

.ig-text-btn.ig-share:disabled {
    color: #a8d8f8;
    cursor: default;
}

.ig-stage {
    flex: 1;
    min-height: 0;
    overflow: auto;
    background: #fff;
    -webkit-overflow-scrolling: touch;
}

.ig-room {
    padding: 0.55rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #8e8e8e;
    border-bottom: 1px solid #f0f0f0;
}

.ig-toast {
    margin: 0.65rem 0.85rem 0;
    padding: 0.65rem 0.8rem;
    border-radius: 0.7rem;
    background: #edf7ed;
    color: #1b5e20;
    font-size: 0.85rem;
    font-weight: 600;
}

.ig-toast.is-error {
    background: #fdecea;
    color: #b71c1c;
}

.ig-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.85rem;
    min-height: 55dvh;
    padding: 2rem 1.25rem;
    color: #8e8e8e;
    text-align: center;
}

.ig-empty p {
    margin: 0;
    font-size: 1rem;
    font-weight: 600;
    color: #262626;
}

.ig-empty-ring {
    width: 84px;
    height: 84px;
    border: 2px solid #262626;
    border-radius: 50%;
    display: grid;
    place-items: center;
    color: #262626;
}

.ig-feed {
    display: flex;
    flex-direction: column;
}

.ig-post {
    border-bottom: 1px solid #efefef;
    background: #fff;
}

.ig-post-head {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.7rem 0.85rem;
}

.ig-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    background: #f0f0f0;
    display: grid;
    place-items: center;
    box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px #e1306c;
}

.ig-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.ig-avatar-char.char-sprite {
    width: 34px;
    height: 34px;
    background-size: 600% 300%;
    transform: scale(1.2);
}

.ig-avatar-letter {
    font-size: 0.85rem;
    font-weight: 800;
    color: #262626;
}

.ig-post-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 0.05rem;
}

.ig-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #262626;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ig-time {
    font-size: 0.7rem;
    font-weight: 500;
    color: #8e8e8e;
}

.ig-media {
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #000;
    overflow: hidden;
}

.ig-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ig-caption {
    margin: 0;
    padding: 0.7rem 0.9rem 0.95rem;
    font-size: 0.9rem;
    font-weight: 500;
    line-height: 1.45;
    color: #262626;
    word-break: break-word;
}

.ig-caption strong {
    font-weight: 700;
    margin-right: 0.3rem;
}

.ig-caption.is-system {
    padding: 0 0.9rem 0.95rem;
    color: #444;
}

.ig-type-rank .ig-caption.is-system {
    color: #9a3412;
}

.ig-type-upload .ig-caption.is-system {
    color: #0c4a6e;
}

.ig-type-rank .ig-avatar,
.ig-type-upload .ig-avatar {
    box-shadow: 0 0 0 1.5px #fff, 0 0 0 2.5px #d4d4d8;
}

.ig-create-stage {
    display: flex;
    flex-direction: column;
}

.ig-create {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.ig-drop {
    position: relative;
    display: block;
    width: 100%;
    aspect-ratio: 1 / 1;
    background: #fafafa;
    border-bottom: 1px solid #efefef;
    cursor: pointer;
    overflow: hidden;
}

.ig-drop input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
    z-index: 2;
}

.ig-drop-idle {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.45rem;
    color: #8e8e8e;
    pointer-events: none;
    z-index: 1;
}

.ig-drop-idle p {
    margin: 0.35rem 0 0;
    font-size: 1rem;
    font-weight: 700;
    color: #262626;
}

.ig-drop-idle span {
    font-size: 0.8rem;
    font-weight: 500;
}

.ig-drop-preview {
    position: absolute;
    inset: 0;
    z-index: 1;
    background: #000;
}

.ig-drop-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ig-create-caption-wrap {
    padding: 0.85rem 0.9rem 1.1rem;
}

.ig-create-caption {
    width: 100%;
    border: none;
    resize: none;
    min-height: 5.5rem;
    padding: 0;
    font: inherit;
    font-size: 0.95rem;
    font-weight: 500;
    color: #262626;
    background: transparent;
}

.ig-create-caption:focus {
    outline: none;
}

.ig-create-caption::placeholder {
    color: #a8a8a8;
}

.ig-create-room {
    margin-top: 0.65rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: #8e8e8e;
}

.detail-fab-btn.feed {
    background: #ea580c;
}

.detail-fab-btn.feed:hover {
    background: #c2410c;
}
