:root {
    --green: #13784f;
    --green-dark: #0b5f3e;
    --green-soft: #e5f2eb;
    --cream: #fff6e8;
    --surface: #ffffff;
    --ink: #152334;
    --muted: #68798b;
    --line: #e3dfd4;
    --orange: #f4a21d;
    --danger: #c94747;
    --radius: 18px;
    --shadow: 0 10px 28px rgba(42, 54, 68, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

.btn {
    border: 1px solid transparent;
    border-radius: 999px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 10px 14px;
    text-decoration: none;
}

.is-disabled {
    pointer-events: none;
    opacity: 0.62;
}

.w-100 {
    width: 100%;
}

body {
    margin: 0;
    background: #e9ecef;
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans Thai", "Noto Sans KR", sans-serif;
    font-size: 16px;
    line-height: 1.5;
}

.app-shell {
    width: min(100%, 430px);
    min-height: 100vh;
    margin: 0 auto;
    background: var(--cream);
    display: flex;
    flex-direction: column;
    box-shadow: 0 0 0 1px rgba(20, 34, 52, 0.06);
}

.topbar {
    background: linear-gradient(180deg, #16875a, var(--green));
    color: #fff;
    padding: env(safe-area-inset-top) 0 0;
}

.topbar-inner {
    min-height: 76px;
    padding: 18px 14px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.topbar-left {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 8px;
}

.topbar h1 {
    margin: 0;
    color: #fff;
    font-size: clamp(1rem, 4vw, 1.18rem);
    font-weight: 850;
    line-height: 1.12;
    word-break: keep-all;
    white-space: nowrap;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex: 0 0 auto;
}

.icon-link {
    width: 28px;
    height: 36px;
    color: #fff;
    text-decoration: none;
    font-size: 2.1rem;
    line-height: 0.85;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.small-action {
    color: #fff;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.4);
    border-radius: 999px;
    padding: 7px 9px;
    font-size: 0.78rem;
    font-weight: 750;
}

.lang-switch {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 999px;
    min-height: 38px;
    padding: 4px;
    display: inline-flex;
    align-items: center;
    gap: 1px;
    font-weight: 800;
}

.lang-switch span {
    font-size: 0.9rem;
    padding: 0 1px;
}

.lang-option {
    color: rgba(255, 255, 255, 0.78);
    text-decoration: none;
    border-radius: 999px;
    padding: 5px 5px;
    font-size: 0.76rem;
    line-height: 1;
}

.lang-option.active {
    background: rgba(255, 255, 255, 0.24);
    color: #fff;
}

.app-main {
    flex: 1;
    padding: 18px 16px 28px;
}

.app-policy-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 18px;
    margin-top: 32px;
    padding: 16px 0 2px;
    border-top: 1px solid rgba(21, 35, 52, 0.1);
    text-align: center;
}

.app-policy-footer a {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
    text-decoration: underline;
    text-underline-offset: 3px;
}

h2 {
    margin: 14px 0 8px;
    color: var(--ink);
    font-size: 1.72rem;
    line-height: 1.15;
    text-align: center;
    font-weight: 900;
    word-break: keep-all;
}

p {
    color: var(--muted);
}

.home-panel,
.login-panel,
.work-panel {
    padding: 18px 0 28px;
}

.home-panel>p,
.login-panel>p,
.work-panel .panel-heading p,
.student-section>p,
.student-home>p {
    text-align: center;
    margin: 0 0 20px;
}

.mascot-frame {
    width: 58px;
    height: 58px;
    flex: 0 0 auto;
    border: 3px dashed #7b848b;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mascot-frame.large {
    width: 82px;
    height: 82px;
    margin: 4px auto 16px;
}

.mascot-frame img {
    width: 72%;
    height: 72%;
    object-fit: contain;
}

.speech-row {
    display: flex;
    gap: 12px;
    align-items: center;
    margin: 16px 0 26px;
}

.portal-grid,
.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
}

.portal-grid {
    grid-template-columns: 1fr;
}

.portal-card,
.feature-card,
.video-card,
.person-card,
.journal-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 2px 0 rgba(20, 34, 52, 0.03);
}

.portal-card,
.feature-card {
    color: var(--ink);
    min-height: 146px;
    padding: 18px 14px;
    text-align: center;
    text-decoration: none;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
}

button.feature-card {
    width: 100%;
    border: 1px solid var(--line);
}

.portal-card span,
.feature-icon {
    font-size: 2.1rem;
    line-height: 1;
}

.portal-card strong,
.feature-card strong,
.video-card strong,
.person-card strong {
    color: var(--ink);
    font-size: 1.12rem;
    font-weight: 900;
    line-height: 1.25;
    word-break: keep-all;
}

.portal-card small,
.feature-card small,
.video-card small,
.person-card small,
.form-help {
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.35;
}

.feature-card:active,
.portal-card:active,
.video-card:active {
    transform: translateY(1px);
    border-color: var(--green);
    outline: 4px solid rgba(244, 162, 29, 0.32);
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.login-panel h2,
.work-panel h2 {
    margin-top: 10px;
}

.form-label {
    color: var(--ink);
    margin-bottom: 0;
    font-weight: 850;
}

.form-control,
.form-select {
    border-color: #cad8d0;
    border-radius: 16px;
    color: var(--ink);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 0.2rem rgba(19, 120, 79, 0.14);
}

.btn-main {
    width: 100%;
    min-height: 58px;
    border-radius: 999px;
    font-size: 1.1rem;
    font-weight: 900;
    margin-top: 6px;
}

.btn-primary {
    --bs-btn-bg: var(--green);
    --bs-btn-border-color: var(--green);
    --bs-btn-hover-bg: var(--green-dark);
    --bs-btn-hover-border-color: var(--green-dark);
    --bs-btn-active-bg: var(--green-dark);
    --bs-btn-active-border-color: var(--green-dark);
}

.btn-outline-danger {
    background: #fff;
    border-color: rgba(201, 71, 71, 0.45);
    color: var(--danger);
    font-weight: 900;
}

.notice {
    border-radius: 14px;
    padding: 12px 14px;
    margin: 0 0 14px;
    font-weight: 750;
}

.notice.success {
    background: var(--green-soft);
    color: var(--green-dark);
    border: 1px solid rgba(19, 120, 79, 0.18);
}

.notice.danger {
    background: #fff0ef;
    color: var(--danger);
    border: 1px solid rgba(201, 71, 71, 0.18);
}

.visually-hidden-input {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    border: 0;
    padding: 0;
}

.file-picker {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.file-picker-button {
    align-items: center;
    background: #fff;
    border: 1px solid #b9d3c7;
    border-radius: 16px;
    color: var(--green-dark);
    cursor: pointer;
    display: flex;
    font-weight: 900;
    justify-content: center;
    min-height: 54px;
    padding: 12px;
}

.file-picker-status {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 750;
    min-height: 22px;
}

.action-overlay {
    position: fixed;
    inset: 0;
    z-index: 3000;
    background: rgba(0, 0, 0, 0.76);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.action-overlay.is-visible {
    display: flex;
}

.action-dialog {
    width: min(100%, 360px);
    background: #fff;
    border-radius: 22px;
    padding: 26px 20px 20px;
    text-align: center;
    box-shadow: 0 18px 70px rgba(0, 0, 0, 0.28);
}

.action-dialog h2 {
    margin: 12px 0 8px;
    font-size: 1.45rem;
}

.action-dialog p {
    margin: 0 0 18px;
}

.action-spinner {
    width: 52px;
    height: 52px;
    margin: 0 auto;
    border: 5px solid #e4e8e2;
    border-top-color: var(--green);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.action-overlay.is-result .action-spinner,
.action-overlay.is-confirm .action-spinner {
    display: none;
}

.action-overlay.is-success .action-dialog::before,
.action-overlay.is-error .action-dialog::before,
.action-overlay.is-confirm .action-dialog::before {
    align-items: center;
    border-radius: 50%;
    display: inline-flex;
    font-size: 2rem;
    font-weight: 900;
    height: 58px;
    justify-content: center;
    margin-bottom: 4px;
    width: 58px;
}

.action-overlay.is-success .action-dialog::before {
    background: var(--green-soft);
    color: var(--green-dark);
    content: "✓";
}

.action-overlay.is-error .action-dialog::before {
    background: #fff0ef;
    color: var(--danger);
    content: "!";
}

.action-overlay.is-confirm .action-dialog::before {
    background: var(--warning-soft);
    color: #995b00;
    content: "?";
}

.action-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.action-buttons .btn-main {
    min-height: 52px;
    margin-top: 0;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.student-section[hidden],
.student-home[hidden],
.video-lightbox[hidden] {
    display: none !important;
}

.back-button {
    border: 1px solid #b9d3c7;
    border-radius: 999px;
    background: #fffdf8;
    color: var(--green-dark);
    padding: 10px 16px;
    font-weight: 900;
    margin-bottom: 10px;
}

.chat-panel {
    min-height: 62vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.chat-log {
    display: flex;
    flex-direction: column;
    gap: 10px;
    flex: 1;
    min-height: 260px;
}

.chat-row {
    display: flex;
    max-width: 88%;
    gap: 8px;
    align-items: flex-start;
}

.chat-row.user {
    align-self: flex-end;
    justify-content: flex-end;
}

.chat-row.assistant {
    align-self: flex-start;
    justify-content: flex-start;
}

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid rgba(28, 61, 112, 0.08);
    background: #ffffff;
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scale(1.2);
    transform-origin: top center;
}

/* Lift Lumi slightly up to avoid chin clipping at the bottom */
.chat-avatar img[src*="lumi.jpg"] {
    transform: scale(1.25) translateY(-3px);
}


.chat-bubble {
    border-radius: 17px;
    padding: 12px 14px;
    white-space: pre-wrap;
    word-break: break-word;
}

.chat-bubble.user {
    background: var(--green);
    color: #fff;
    border-top-right-radius: 6px;
    border-bottom-right-radius: 17px;
}

.chat-bubble.assistant {
    background: #fff;
    border: 1px solid var(--line);
    color: var(--ink);
    border-top-left-radius: 6px;
    border-bottom-left-radius: 17px;
}

.chat-bubble.pending {
    color: var(--muted);
}

.chat-form {
    background: rgba(252, 252, 252, 0.96);
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    position: sticky;
    bottom: 0;
    padding: 10px 0 15px;
}

.segmented-control {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.segmented-control label {
    margin: 0;
}

.segmented-control input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.segmented-control span {
    display: block;
    min-height: 48px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    color: var(--muted);
    text-align: center;
    font-weight: 900;
}

.segmented-control input:checked+span {
    border-color: var(--green);
    outline: 4px solid rgba(244, 162, 29, 0.22);
    color: var(--green-dark);
}

.image-result {
    margin-top: 16px;
}

.ai-inline-notice {
    margin: -24px 0 18px !important;
    color: var(--muted);
    font-size: 0.76rem;
    line-height: 1.5;
    text-align: center;
}

.ai-inline-notice a {
    color: var(--green-dark);
    font-weight: 800;
    white-space: nowrap;
}

.face-ai-consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid rgba(19, 120, 79, 0.22);
    border-radius: 8px;
    background: rgba(229, 242, 235, 0.7);
    color: var(--ink);
    font-size: 0.86rem;
    line-height: 1.45;
}

.face-ai-consent[hidden] {
    display: none !important;
}

.face-ai-consent input,
.ai-consent-choice input {
    width: 22px;
    height: 22px;
    margin: 0;
    flex: 0 0 auto;
    accent-color: var(--green);
}

body.has-ai-consent-gate {
    overflow: hidden;
}

.ai-consent-gate {
    position: fixed;
    inset: 0;
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
    background: rgba(9, 21, 31, 0.78);
}

.ai-consent-dialog {
    width: min(100%, 390px);
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    padding: 22px 18px 18px;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 24px 80px rgba(0, 0, 0, 0.3);
}

.ai-consent-badge {
    display: inline-block;
    color: var(--green-dark);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0;
}

.ai-consent-dialog h2 {
    margin: 7px 0 8px;
    font-size: 1.45rem;
    text-align: left;
}

.ai-consent-intro {
    margin: 0 0 14px;
    color: var(--ink);
    font-size: 0.94rem;
    line-height: 1.5;
}

.ai-consent-points {
    margin: 0 0 16px;
    padding: 14px 14px 14px 32px;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.55;
}

.ai-consent-points li + li {
    margin-top: 6px;
}

.ai-consent-choice {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin: 0 0 9px;
    padding: 11px;
    border: 1px solid rgba(21, 35, 52, 0.13);
    border-radius: 8px;
    color: var(--ink);
    font-size: 0.84rem;
    font-weight: 700;
    line-height: 1.42;
    cursor: pointer;
}

.ai-consent-dialog .btn-main {
    width: 100%;
    margin-top: 5px;
}

.ai-consent-error {
    margin: 10px 0;
    font-size: 0.82rem;
}

.ai-consent-links {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin-top: 14px;
}

.ai-consent-links a {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 750;
}

.privacy-page {
    padding: 4px 0 16px;
}

.privacy-hero {
    padding: 18px 0 24px;
}

.privacy-hero h2 {
    margin: 8px 0 10px;
    text-align: left;
}

.privacy-hero p,
.privacy-section p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.privacy-supervision-notice {
    margin: 0 0 20px;
    padding: 15px 16px;
    border: 1px solid rgba(214, 125, 23, 0.28);
    border-left: 4px solid var(--orange);
    border-radius: 8px;
    background: rgba(255, 247, 229, 0.72);
}

.privacy-supervision-notice strong {
    display: block;
    color: var(--ink);
    font-size: 0.96rem;
    font-weight: 900;
}

.privacy-supervision-notice p {
    margin: 6px 0 0;
    color: #52675d;
    font-size: 0.84rem;
    line-height: 1.62;
}

.privacy-section {
    padding: 20px 0;
    border-top: 1px solid rgba(21, 35, 52, 0.11);
}

.privacy-section h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 1.03rem;
    font-weight: 900;
}

.privacy-delete-button {
    width: 100%;
    margin-top: 16px;
}

.privacy-section .form-help {
    display: block;
    margin-top: 8px;
}

.privacy-info-list {
    display: grid;
    gap: 14px;
    margin: 18px 0 0;
    padding: 0;
    list-style: none;
}

.privacy-info-list li {
    padding-left: 12px;
    border-left: 3px solid rgba(19, 120, 79, 0.28);
}

.privacy-info-list strong,
.privacy-info-list span {
    display: block;
}

.privacy-info-list strong {
    margin-bottom: 3px;
    color: var(--ink);
    font-size: 0.9rem;
    font-weight: 900;
}

.privacy-info-list span {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.58;
}

.privacy-detail-list {
    margin: 18px 0 0;
    border-top: 1px solid rgba(21, 35, 52, 0.12);
}

.privacy-detail-list div {
    display: grid;
    grid-template-columns: minmax(92px, 0.34fr) minmax(0, 1fr);
    gap: 12px;
    padding: 11px 0;
    border-bottom: 1px solid rgba(21, 35, 52, 0.1);
}

.privacy-detail-list dt,
.privacy-detail-list dd {
    margin: 0;
}

.privacy-detail-list dt {
    color: var(--ink);
    font-size: 0.8rem;
    font-weight: 900;
}

.privacy-detail-list dd {
    min-width: 0;
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.privacy-controller-list {
    margin-top: 14px;
}

.privacy-version {
    margin: 14px 0 0;
    color: var(--muted);
    font-size: 0.74rem;
    text-align: right;
}

.manual-page {
    padding: 4px 0 16px;
}

.manual-hero {
    padding: 18px 0 24px;
}

.manual-kicker {
    color: var(--green-dark);
    font-size: 0.72rem;
    font-weight: 900;
    letter-spacing: 0;
}

.manual-hero h2 {
    margin: 8px 0 10px;
    text-align: left;
}

.manual-hero p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.manual-jump {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0 0 8px;
    border: 1px solid rgba(21, 35, 52, 0.12);
    border-radius: 8px;
    overflow: hidden;
    background: rgba(21, 35, 52, 0.12);
}

.manual-jump a {
    min-width: 0;
    padding: 10px 8px;
    background: #fff;
    color: var(--ink);
    font-size: 0.79rem;
    font-weight: 800;
    text-align: center;
    text-decoration: none;
    word-break: keep-all;
}

.manual-section {
    padding: 24px 0;
    border-bottom: 1px solid rgba(21, 35, 52, 0.11);
    scroll-margin-top: 16px;
}

.manual-section h3 {
    margin: 0 0 8px;
    color: var(--ink);
    font-size: 1.22rem;
    font-weight: 900;
}

.manual-section-description {
    margin: 0 0 18px;
    color: #52675d;
    font-size: 0.9rem;
    line-height: 1.65;
}

.manual-steps {
    display: grid;
    gap: 18px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.manual-steps li {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
}

.manual-step-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: var(--green-soft);
    color: var(--green-dark);
    font-size: 0.8rem;
    font-weight: 900;
}

.manual-steps strong {
    display: block;
    margin: 1px 0 3px;
    color: var(--ink);
    font-size: 0.96rem;
    font-weight: 900;
}

.manual-steps p {
    margin: 0;
    color: var(--muted);
    font-size: 0.88rem;
    line-height: 1.6;
}

.manual-note {
    margin: 24px 0 0;
    padding: 14px 0 14px 14px;
    border-left: 4px solid var(--orange);
}

.manual-note strong {
    color: var(--ink);
    font-weight: 900;
}

.manual-note p {
    margin: 4px 0 7px;
    color: var(--muted);
    font-size: 0.86rem;
    line-height: 1.55;
}

.manual-note a {
    color: var(--green-dark);
    font-size: 0.82rem;
    font-weight: 850;
}

.manual-start-button {
    width: 100%;
    min-height: 54px;
    margin-top: 22px;
}

.home-help-link {
    text-align: center;
}

.home-help-link a {
    color: #6f8293;
    font-size: 0.76rem;
    font-weight: 800;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.image-result img {
    width: 100%;
    border-radius: 18px;
    border: 1px solid var(--line);
    background: #fff;
}

.image-result-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 12px;
}

.print-image-button {
    width: 100%;
    min-height: 54px;
    border-color: rgba(21, 35, 52, 0.22);
    background: #fff;
    color: var(--ink);
    font-weight: 900;
}

.download-link {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 54px;
    border-radius: 999px;
    background: var(--orange);
    color: var(--ink);
    text-decoration: none;
    font-weight: 900;
}

@media print {
    @page {
        margin: 10mm;
    }

    body.page-dream-image {
        min-height: 0;
        background: #fff;
    }

    body.page-dream-image .app-shell {
        width: 100%;
        min-height: 0;
        box-shadow: none;
    }

    body.page-dream-image .topbar,
    body.page-dream-image .student-section > :not(.image-result),
    body.page-dream-image .image-result .notice,
    body.page-dream-image .image-result-actions,
    body.page-dream-image .app-policy-footer,
    body.page-dream-image .action-overlay {
        display: none !important;
    }

    body.page-dream-image .app-main,
    body.page-dream-image .student-section,
    body.page-dream-image .image-result {
        width: 100%;
        min-height: 0;
        margin: 0;
        padding: 0;
        overflow: visible;
    }

    body.page-dream-image .image-result img {
        display: block;
        width: auto;
        max-width: 100%;
        max-height: calc(100vh - 20mm);
        margin: 0 auto;
        border: 0;
        border-radius: 0;
        object-fit: contain;
    }
}

.video-grid,
.people-grid,
.journal-list {
    display: grid;
    gap: 12px;
}

.video-grid,
.people-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.student-section > .content-curation-note {
    margin: -24px 0 20px;
    padding-left: 10px;
    border-left: 3px solid rgba(19, 120, 79, 0.28);
    color: #6f7c75;
    font-size: 0.76rem;
    line-height: 1.55;
    text-align: left;
}

.video-card {
    width: 100%;
    padding: 10px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.video-card strong {
    font-size: 0.95rem;
    font-weight: 700;
    text-align: center;
    display: block;
}

.video-thumb {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 13px;
    background-size: cover;
    background-position: center;
    background-color: #dfe5e0;
    color: rgba(19, 120, 79, 0.72);
    display: grid;
    font-size: 2rem;
    font-weight: 900;
    place-items: center;
    text-indent: -999px;
    overflow: hidden;
}

.video-thumb.empty {
    background: linear-gradient(135deg, #eef5ef, #dfe8e1);
    text-indent: 0;
}

.video-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.82);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
}

.video-frame {
    width: min(100%, 920px);
    aspect-ratio: 16 / 9;
    background: #000;
}

.video-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

.lightbox-close {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #111;
    font-size: 2rem;
    line-height: 1;
}

.person-card {
    padding: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.person-photo {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 14px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(20, 35, 52, 0.18)),
        repeating-linear-gradient(45deg, #bfc5c0, #bfc5c0 10px, #d7dbd6 10px, #d7dbd6 20px);
    filter: grayscale(1);
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(21, 35, 52, 0.45);
    font-weight: 900;
}

.journal-textarea {
    min-height: 220px;
}

.panel-heading {
    margin-bottom: 16px;
}

.empty-state {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    color: var(--muted);
    padding: 28px 16px;
    text-align: center;
}

.journal-card {
    padding: 14px;
}

.journal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 0.88rem;
    margin-bottom: 10px;
}

.journal-meta strong {
    color: var(--green-dark);
}

.journal-photos {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    margin-bottom: 12px;
}

.journal-photos img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: 10px;
}

.journal-body {
    background: #fffdf8;
    border-radius: 12px;
    color: var(--ink);
    padding: 12px;
    white-space: normal;
}

@media (max-width: 360px) {
    .topbar-inner {
        padding-left: 12px;
        padding-right: 12px;
    }

    .app-main {
        padding-left: 12px;
        padding-right: 12px;
    }

    .feature-grid,
    .video-grid,
    .people-grid {
        gap: 9px;
    }

    .feature-card,
    .portal-card {
        min-height: 132px;
        padding: 14px 10px;
    }

    h2 {
        font-size: 1.48rem;
    }
}

/* Typing Animation (Bouncing Dots) */
.typing-indicator {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 5px 0;
}

.typing-dot {
    width: 6px;
    height: 6px;
    background-color: #888;
    border-radius: 50%;
    animation: typingBounce 1.4s infinite ease-in-out both;
}

.typing-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-dot:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes typingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* Participating Organizations */
.partner-logo-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: stretch;
    margin-top: 2.5rem;
    padding: 12px;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.14);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
}

.partner-logo-cell {
    display: grid;
    place-items: center;
    width: 100%;
    height: 64px;
    overflow: hidden;
}

.partner-logo-grid img {
    display: block;
    width: 100%;
    height: 64px;
    padding: 6px;
    object-fit: contain;
    background: transparent;
    transform: translate(var(--logo-x, 0), var(--logo-y, 0)) scale(var(--logo-scale, 1));
    transform-origin: center;
}

/* Little PM */
.portal-admin .app-shell,
.portal-mentor .app-shell {
    width: min(100%, 1120px);
    background: #f6f8f7;
}

.portal-admin .app-main,
.portal-mentor .app-main {
    padding: 24px;
}

.portal-admin .topbar h1,
.portal-mentor .topbar h1 {
    white-space: normal;
}

.pm-title h2 {
    margin-bottom: 4px;
}

.pm-title p {
    margin: 0 0 14px;
    text-align: center;
}

.pm-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 2px 0 rgba(20, 34, 52, 0.03);
}

.pm-progress-wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    margin: 0 0 14px;
}

.pm-progress {
    display: grid;
    grid-template-columns: repeat(16, minmax(0, 1fr));
    gap: 3px;
}

.pm-progress span,
.pm-progress a {
    display: block;
    height: 8px;
    border-radius: 999px;
    background: rgba(19, 120, 79, 0.16);
    text-decoration: none;
}

.pm-progress span.done,
.pm-progress a.done,
.pm-progress a.now {
    background: var(--green);
}

.pm-progress a.now {
    box-shadow: 0 0 0 3px rgba(19, 120, 79, 0.18);
}

.pm-progress a.jumpable {
    cursor: pointer;
}

.pm-progress a.jumpable:hover {
    background: var(--green-dark);
}

.pm-progress-wrap strong {
    color: var(--green-dark);
    font-size: 0.82rem;
    font-weight: 900;
    white-space: nowrap;
}

.pm-step-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pm-step-head h3 {
    margin: 0;
    color: var(--ink);
    font-size: 1.16rem;
    font-weight: 900;
}

.pm-step-head a {
    color: var(--green-dark);
    font-size: 0.86rem;
    font-weight: 850;
    text-decoration: none;
}

.pm-action-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.pm-action-row .btn:only-child {
    grid-column: 1 / -1;
}

.pm-help {
    margin: 2px 0 10px;
    color: var(--muted);
    font-size: 0.92rem;
}

.pm-choice-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.pm-choice {
    display: block;
    margin: 0;
}

.pm-choice input,
.pm-job input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.pm-choice-box {
    min-height: 96px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 10px 8px;
    background: #fffdf8;
    border: 1px solid #e7e2d5;
    border-radius: 14px;
    text-align: center;
}

.pm-choice-box b {
    font-size: 1.72rem;
    line-height: 1;
}

.pm-choice-box strong {
    color: var(--ink);
    font-size: 0.94rem;
    line-height: 1.22;
}

.pm-choice-box small {
    color: var(--muted);
    font-size: 0.74rem;
    line-height: 1.2;
}

.pm-choice input:checked+.pm-choice-box,
.pm-job input:checked+span {
    border-color: var(--green);
    outline: 4px solid rgba(244, 162, 29, 0.22);
    background: var(--green-soft);
}

.pm-choice.is-disabled,
.pm-job.is-disabled {
    opacity: 0.42;
    cursor: not-allowed;
}

.pm-choice.is-disabled .pm-choice-box,
.pm-job.is-disabled span {
    cursor: not-allowed;
}

.pm-subtitle {
    margin: 12px 0 8px;
    color: var(--green-dark);
    font-weight: 900;
}

.pm-job-grid {
    display: grid;
    gap: 8px;
}

.pm-job {
    display: block;
    margin: 0;
}

.pm-job span {
    display: grid;
    gap: 2px;
    min-height: 62px;
    padding: 10px 12px;
    background: #fffdf8;
    border: 1px solid #e7e2d5;
    border-radius: 14px;
}

.pm-job b {
    color: var(--ink);
    font-size: 0.98rem;
}

.pm-job small {
    color: var(--muted);
}

.pm-report-header {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 16px;
    background: linear-gradient(180deg, #e6f4ff, #f8fbff);
}

.pm-report-header h3 {
    margin: 0;
    color: var(--ink);
    font-weight: 900;
}

.pm-report-header p {
    margin: 0;
}

.pm-report-section {
    padding: 12px 0;
    border-top: 1px solid var(--line);
}

.pm-report-section h4 {
    margin: 0 0 6px;
    color: var(--green-dark);
    font-size: 1rem;
    font-weight: 900;
}

.pm-report-section p {
    margin: 0 0 6px;
    color: var(--ink);
}

.pm-report-photo,
.pm-admin-photo {
    width: 100%;
    border-radius: 14px;
    border: 1px solid var(--line);
    object-fit: cover;
}

.pm-report-photo {
    margin: 12px 0;
}

.pm-map-mini ol {
    display: grid;
    gap: 8px;
    padding: 0;
    margin: 0;
    list-style: none;
}

.pm-map-mini li {
    display: grid;
    gap: 2px;
    padding: 10px 12px;
    background: #fffdf8;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.first-action {
    padding: 12px;
    border: 1px solid #efd584;
    border-radius: 14px;
    background: #fffde7;
}

.pm-report-actions {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.pm-tabs {
    gap: 8px;
    margin-bottom: 16px;
}

.pm-tabs .nav-link {
    border: 1px solid #d4ddd8;
    color: var(--green-dark);
    font-weight: 850;
}

.pm-tabs .nav-link.active {
    background: var(--green);
    border-color: var(--green);
}

.pm-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}

.pm-stat-grid article {
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.pm-stat-grid strong {
    display: block;
    color: var(--green-dark);
    font-size: 1.8rem;
    line-height: 1;
}

.pm-stat-grid span {
    color: var(--muted);
    font-weight: 750;
}

.pm-admin-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.pm-admin-card {
    padding: 16px;
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.pm-admin-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.pm-admin-main strong {
    color: var(--ink);
    font-size: 1.08rem;
    font-weight: 900;
}

.pm-admin-main small {
    display: block;
    color: var(--muted);
}

.pm-progress-chip {
    min-width: 48px;
    padding: 6px 8px;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green-dark);
    text-align: center;
    font-weight: 900;
}

.pm-mini-progress {
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: rgba(19, 120, 79, 0.12);
    margin-bottom: 12px;
}

.pm-mini-progress span {
    display: block;
    height: 100%;
    background: var(--green);
}

.pm-admin-dl {
    display: grid;
    grid-template-columns: 70px 1fr;
    gap: 6px 10px;
    margin: 0 0 12px;
}

.pm-admin-dl dt {
    color: var(--muted);
    font-weight: 850;
}

.pm-admin-dl dd {
    margin: 0;
    color: var(--ink);
}

.pm-details {
    margin: 10px 0;
}

.pm-details summary {
    cursor: pointer;
    color: var(--green-dark);
    font-weight: 900;
}

.pm-report-plain {
    margin-top: 8px;
    padding: 10px;
    border-radius: 12px;
    background: #fffdf8;
}

.pm-report-plain p {
    margin: 0 0 6px;
    color: var(--ink);
}

.pm-report-inline {
    margin: 12px 0;
}

.pm-comment {
    margin: 8px 0;
    padding: 10px 12px;
    border-radius: 12px;
    background: #eef5ef;
    color: var(--ink);
}

.pm-comment small {
    color: var(--muted);
    font-weight: 750;
}

.pm-comment-form {
    margin-top: 10px;
}

@media (max-width: 760px) {

    .portal-admin .app-main,
    .portal-mentor .app-main {
        padding: 18px 14px 28px;
    }

    .pm-stat-grid,
    .pm-admin-list {
        grid-template-columns: 1fr;
    }

}

/* ==========================================
   Home Redesign - Dream Bridge Main Portal
   ========================================== */

/* 1. Portal Home layout setup */
body.portal-home {
    background: #a9d4ff;
    /* Fallback sky blue */
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    margin: 0;
}

body.portal-home .app-shell {
    background: url('../images/design/main_bg.gif') no-repeat center top #a9d4ff;
    background-size: cover;
    position: relative;
    height: 1020px;
    max-height: none;
    min-height: auto;
    border-radius: 32px;
    box-shadow: 0 20px 50px rgba(28, 61, 112, 0.15);
    overflow: hidden;
    margin: auto;
}

/* 작은 화면에서도 콘텐츠를 압축하지 않고 세로로 스크롤되도록 처리 */
@media (max-height: 840px) or (max-width: 430px) {
    body.portal-home .app-shell {
        height: max(100vh, 1020px);
        max-height: none;
        border-radius: 0;
        box-shadow: none;
    }
}

/* Hide header bar but keep lang switch on top right */
body.portal-home .topbar {
    background: transparent;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
}

body.portal-home .topbar-inner {
    min-height: auto;
    padding: 16px 20px;
}

body.portal-home .topbar-left {
    display: none;
}

body.portal-home .topbar-actions {
    margin-left: auto;
}

body.portal-home .lang-switch {
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

body.portal-home .lang-option.active {
    background: rgba(255, 255, 255, 0.7);
    color: #1c3d70;
}

body.portal-home .lang-option {
    color: #1c3d70;
}

/* 2. Main content styling */
body.portal-home .app-main {
    padding: 0;
    height: 100%;
}

.home-panel-v2 {
    display: flex;
    flex-direction: column;
    height: 100%;
    box-sizing: border-box;
    padding: 60px 24px 32px;
    /* Top padding leaves space for lang-switch */
    justify-content: space-between;
    position: relative;
}

/* Background webm video loop styling */
.home-bg-video {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
    pointer-events: none;
}

.home-top-section,
.home-character-spacer,
.home-bottom-section {
    position: relative;
    z-index: 1;
}

body.portal-home .lang-switch {
    z-index: 2;
}

.home-top-section {
    text-align: center;
    margin-top: 10px;
}

.home-title-main {
    font-size: 3.2rem;
    font-weight: 900;
    color: #ffffff;
    margin: 0 0 4px;
    letter-spacing: -1.5px;
    text-shadow: 0 4px 12px rgba(28, 61, 112, 0.35);
    line-height: 1.1;
    font-family: 'Outfit', 'Inter', sans-serif;
}

.home-subtitle-main {
    font-size: 1.15rem;
    font-weight: 750;
    color: #173d70;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7), 0 0 5px rgba(255, 255, 255, 0.4);
    margin: 0;
    word-break: keep-all;
}

/* Character spacer: allocates visual space for the characters in main_bg.gif */
.home-character-spacer {
    height: 270px;
    flex: 0 0 270px;
    pointer-events: none;
}

/* 화면 높이가 작은 기기에서는 제목과 버튼만 소폭 축소 */
@media (max-height: 740px) {
    .home-title-main {
        font-size: 2.6rem;
    }

    .btn-student-travel {
        min-height: 80px;
    }
}

.home-bottom-section {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.home-intro-text {
    text-align: center;
    margin-bottom: 8px;
}

.home-intro-title {
    font-size: 1.35rem;
    font-weight: 850;
    color: #173d70;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7), 0 0 5px rgba(255, 255, 255, 0.4);
    margin: 0 0 6px;
    letter-spacing: -0.5px;
}

.home-intro-desc {
    font-size: 0.95rem;
    font-weight: 600;
    color: #4a6c94;
    text-shadow: 0 1px 2px rgba(255, 255, 255, 0.7), 0 0 5px rgba(255, 255, 255, 0.4);
    line-height: 1.45;
    margin: 0;
    white-space: pre-line;
}

/* 3. Main Yellow Button (Student travel start) */
.btn-student-travel {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 84px;
    padding: 12px 20px;
    background: linear-gradient(180deg, #ffe566 0%, #f6b500 100%);
    border: 3px solid #ffffff;
    border-radius: 30px;
    color: #5d3800;
    text-decoration: none;
    box-shadow:
        0 10px 24px rgba(28, 61, 112, 0.15),
        inset 0 4px 6px rgba(255, 255, 255, 0.5);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.btn-student-travel::before {
    content: '';
    position: absolute;
    top: 0;
    left: -50%;
    width: 200%;
    height: 100%;
    background: linear-gradient(to right,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.3) 50%,
            rgba(255, 255, 255, 0) 100%);
    transform: skewX(-25deg);
    transition: 0.75s;
    opacity: 0;
}

.btn-student-travel:hover::before {
    left: 125%;
    opacity: 1;
}

.btn-student-travel:hover {
    transform: translateY(-3px) scale(1.015);
    box-shadow:
        0 14px 28px rgba(28, 61, 112, 0.2),
        inset 0 4px 6px rgba(255, 255, 255, 0.7);
    color: #4a2d00;
}

.btn-student-travel:active {
    transform: translateY(1px) scale(0.985);
    box-shadow:
        0 6px 12px rgba(28, 61, 112, 0.15),
        inset 0 2px 3px rgba(255, 255, 255, 0.3);
}

.btn-student-travel-content {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    position: relative;
}

.btn-student-travel-text {
    font-size: 1.5rem;
    font-weight: 900;
    letter-spacing: -0.5px;
    margin-right: 4px;
}

.btn-student-travel-arrow {
    font-size: 1.5rem;
    font-weight: 900;
    margin-left: 6px;
    transition: transform 0.2s ease;
}

.btn-student-travel:hover .btn-student-travel-arrow {
    transform: translateX(4px);
}

.btn-student-travel-sub {
    font-size: 0.9rem;
    font-weight: 750;
    opacity: 0.85;
    margin-top: 2px;
}

/* 4. Sub portal grid (Mentor & Admin) */
.sub-portal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    align-items: stretch;
}

.card-sub-portal {
    background: #ffffff;
    border: 1px solid rgba(28, 61, 112, 0.08);
    border-radius: 20px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    box-shadow: 0 8px 20px rgba(28, 61, 112, 0.05);
    transition: all 0.2s ease;
    height: 74px;
    /* Fixed height for symmetry */
    box-sizing: border-box;
}

.card-sub-portal:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 24px rgba(28, 61, 112, 0.08);
}

.card-sub-portal:active {
    transform: translateY(1px);
}

.card-sub-portal-icon-wrapper {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 1.15rem;
}

/* Blue circle for mentor */
.card-sub-portal-icon-wrapper.mentor-icon {
    background: #e6f0ff;
    color: #0056b3;
    box-shadow: inset 0 2px 5px rgba(0, 86, 179, 0.05);
}

/* Green circle for admin */
.card-sub-portal-icon-wrapper.admin-icon {
    background: #e6f6ee;
    color: #198754;
    box-shadow: inset 0 2px 5px rgba(25, 135, 84, 0.05);
}

.card-sub-portal-info {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
    flex: 1;
    height: 100%;
}

.card-sub-portal-title {
    font-size: 1.05rem;
    font-weight: 850;
    color: #173d70;
    line-height: 1.1;
}

.card-sub-portal-desc {
    font-size: 0.78rem;
    font-weight: 600;
    color: #728ea7;
    margin-top: 1px;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 5. Footer & participating organizations */
body.portal-home .partner-logo-grid {
    width: auto;
    margin: 0 -24px -32px;
    padding: 16px 24px calc(16px + env(safe-area-inset-bottom));
    gap: 8px;
}

/* IP-restricted monitoring shortcut */
.monitoring-text-link {
    position: absolute;
    top: 16px;
    left: 20px;
    z-index: 101;
    margin: 0;
}

.monitoring-text-link a {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.78rem;
    font-weight: 750;
    color: #173d70;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.28);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.4);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background-color 0.2s ease;
}

.monitoring-text-link a:hover {
    background: rgba(255, 255, 255, 0.68);
}

/* 6. Language-specific font sizing to prevent overflow with longer text (TH / EN) */
html[lang="th"] .btn-student-travel-text,
html[lang="en"] .btn-student-travel-text {
    font-size: 1.35rem;
}

html[lang="th"] .card-sub-portal-title,
html[lang="en"] .card-sub-portal-title {
    font-size: 0.92rem;
}

html[lang="th"] .card-sub-portal-desc,
html[lang="en"] .card-sub-portal-desc {
    font-size: 0.68rem;
}

/* 7. Student Portal Image-based 3D Buttons */
.feature-grid-v2 {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 10px;
}

.feature-image-btn-v2 {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: #ffffff;
    border-radius: 28px;
    overflow: hidden;
    text-decoration: none;
    box-shadow: 0 8px 24px rgba(28, 61, 112, 0.05);
    transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(28, 61, 112, 0.04);
    aspect-ratio: 1 / 1.12; /* 고정된 1:1.12 정사각 비율 */
    box-sizing: border-box;
}

.feature-image-btn-v2:hover {
    transform: translateY(-5px) scale(1.025);
    box-shadow: 0 16px 36px rgba(28, 61, 112, 0.1);
}

.feature-image-btn-v2:active {
    transform: translateY(1px) scale(0.975);
    box-shadow: 0 6px 14px rgba(28, 61, 112, 0.05);
}

.feature-btn-thumb {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    background: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 14px 14px 4px;
    box-sizing: border-box;
}

.feature-btn-thumb img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain; /* 이미지 잘림 원천 차단 */
}

.feature-btn-body {
    padding: 4px 8px 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 3px;
    background: #ffffff;
    flex-shrink: 0;
    box-sizing: border-box;
}

.feature-btn-body strong {
    font-size: 0.95rem;
    font-weight: 850;
    color: #173d70;
    line-height: 1.15;
    word-break: keep-all;
}

.feature-btn-body p {
    font-size: 0.72rem;
    font-weight: 600;
    color: #728ea7;
    line-height: 1.25;
    margin: 0;
    word-break: keep-all;
}

/* Language-specific layout scaling to prevent overflow on TH/EN */
html[lang="th"] .feature-btn-body strong,
html[lang="en"] .feature-btn-body strong {
    font-size: 0.84rem;
}

html[lang="th"] .feature-btn-body p,
html[lang="en"] .feature-btn-body p {
    font-size: 0.65rem;
}

/* 8. Background white adjustment for portal-student to blend image buttons */
body.portal-student .app-shell {
    background: #fcfcfc;
}

/* 9. MVP Stage Notice Text on Main Portal */
.mvp-notice-text {
    font-size: 0.72rem;
    font-weight: 600;
    color: #8c9eae;
    text-align: center;
    margin: 4px 0 0;
    line-height: 1.4;
    word-break: keep-all;
}

/* 10. People page 1col list styling */
.people-list-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
    margin-top: 20px;
}

.people-section-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.people-group-title {
    font-size: 1.15rem;
    font-weight: 850;
    color: #173d70;
    border-bottom: 2px solid rgba(28, 61, 112, 0.08);
    padding-bottom: 8px;
    margin: 0 0 10px 0;
}

.person-card-v2 {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
    border-radius: 0;
    padding: 0;
    border: none;
    box-shadow: none;
    margin-bottom: 28px;
}

.person-photo-v2 {
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 20px;
    overflow: hidden;
    background: #f8fafc;
    border: 1px solid rgba(28, 61, 112, 0.06);
}

.person-photo-v2 img {
    width: 100%;
    height: auto;
    display: block;
}

.person-info-v2 {
    margin-top: 12px;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.person-role {
    font-size: 0.88rem;
    font-weight: 750;
    color: #728ea7;
}

.person-info-v2 strong {
    font-size: 1.15rem;
    font-weight: 850;
    color: #173d70;
    letter-spacing: 0.3px;
    line-height: 1.1;
}

.people-developer {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin: 18px 0 12px;
    padding: 13px 14px;
    border: 1px solid rgba(28, 61, 112, 0.13);
    border-radius: 8px;
    background: rgba(244, 248, 246, 0.82);
    text-align: left;
}

.people-developer-copy {
    min-width: 0;
}

.people-developer small,
.people-developer strong {
    display: block;
}

.people-developer small {
    color: #728ea7;
    font-size: 0.68rem;
    font-weight: 750;
    line-height: 1.35;
}

.people-developer strong {
    margin-top: 2px;
    color: #173d70;
    font-size: 0.9rem;
    font-weight: 900;
    line-height: 1.3;
}

.people-developer a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    gap: 5px;
    min-height: 36px;
    padding: 7px 11px;
    border: 1px solid rgba(19, 120, 79, 0.28);
    border-radius: 7px;
    background: #fff;
    color: var(--green-dark);
    font-size: 0.74rem;
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
}

/* 11. Student Section Header Margins Override */
.student-section h2 {
    margin: 28px 0 16px; /* 위아래 마진 약 2배 확대 */
}

.student-section > p {
    margin: 0 0 40px; /* 설명글 하단 마진 2배 확대 */
}

/* 12. Student Section Corner Decoration Background (dream-image.php) */
.student-section {
    position: relative;
    overflow: hidden;
}

.student-section h2,
.student-section p,
.student-section form,
.student-section .image-result {
    position: relative;
    z-index: 1;
}

.student-deco-bg {
    position: absolute;
    top: 0;
    right: 0;
    width: 120px;
    height: auto;
    opacity: 1;
    z-index: 0;
    pointer-events: none;
}

.student-deco-bg img {
    width: 100%;
    height: auto;
    display: block;
}
