/* =========================================================================
   taVNS 환자앱 사용 안내 — 대화형 어시스턴트 가이드 (silver_tavns 컨셉)
   단독형 스타일시트: manual.css 를 사용하지 않음 (patient.html 전용)
   팔레트/토큰: screens/silver_tavns/* 의 tailwind-config 와 동일
   원칙: 한 화면 = 한 행동, 초대형 터치 영역, 도우미 말풍선 안내
   ========================================================================= */

:root {
    --primary: #1e00a9;
    --primary-container: #3525cd;
    --primary-fixed: #e2dfff;
    --on-primary-fixed: #0f0069;
    --secondary: #006c49;
    --secondary-container: #9af2c5;
    --on-secondary-dark: #005236;
    --error: #ba1a1a;
    --error-container: #ffdad6;
    --on-error-container: #93000a;
    --surface: #f8f9fa;
    --surface-low: #f3f4f5;
    --surface-container: #edeeef;
    --surface-high: #e7e8e9;
    --on-surface: #191c1d;
    --on-surface-variant: #464555;
    --outline-variant: rgba(199, 196, 216, 0.45);
    --white: #ffffff;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

html, body {
    max-width: 100%;
    overflow-x: hidden;
}

body {
    margin: 0;
    font-family: 'Noto Sans KR', 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--surface);
    color: var(--on-surface);
    font-size: 20px;
    line-height: 1.8;
    -webkit-font-smoothing: antialiased;
    word-break: keep-all;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Material Symbols 아이콘 ---------- */
.ms {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    display: inline-block;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    white-space: nowrap;
    direction: ltr;
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 1;
    font-size: 1.3em;
    vertical-align: -0.25em;
    flex-shrink: 0;
}

/* ---------- 상단 바 ---------- */
.topbar {
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 72px;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--outline-variant);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    z-index: 100;
}
.topbar-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 48px;
    padding: 8px 14px;
    border: none;
    background: none;
    border-radius: 99px;
    color: var(--primary);
    font: inherit;
    font-size: 1.02rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.2s;
}
.topbar-btn:hover { background: var(--surface-container); }
.topbar-btn:active { transform: scale(0.96); }
.topbar-title {
    flex: 1;
    min-width: 0;
    text-align: center;
    font-size: 1.12rem;
    font-weight: 800;
    color: var(--on-surface);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------- 화면(스크린) 전환 ---------- */
.stage {
    max-width: 760px;
    margin: 0 auto;
    padding: 100px 16px 72px;
}
.screen { display: none; }
.screen.active {
    display: block;
    animation: fadeUp 0.35s ease-out;
}

/* ---------- 도우미 말풍선 ---------- */
.assist {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 28px;
}
.assist-avatar {
    flex-shrink: 0;
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}
.assist-avatar .ms { font-size: 40px; vertical-align: 0; }

/* 마스코트(AI 캐릭터) 아바타 — 브랜드 색 후광으로 감싸 붕 뜬 느낌 제거 */
.assist-avatar--img {
    background: linear-gradient(160deg, var(--primary-fixed) 0%, #ffffff 65%);
    border: 3px solid #ffffff;
    box-shadow: 0 0 0 2px var(--primary-fixed), var(--shadow-sm);
    overflow: hidden;
}
.assist-avatar--img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: 50% 15%;
    display: block;
    transform: scale(1.4);
    transform-origin: 50% 18%;
}
.assist-bubble {
    position: relative;
    flex: 1;
    min-width: 0;
    background: var(--white);
    border: 1px solid var(--outline-variant);
    border-radius: 1.75rem;
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
}
.assist-bubble::before {
    content: "";
    position: absolute;
    left: -9px;
    top: 26px;
    width: 18px;
    height: 18px;
    background: var(--white);
    border-left: 1px solid var(--outline-variant);
    border-bottom: 1px solid var(--outline-variant);
    transform: rotate(45deg);
    border-radius: 0 0 0 5px;
}
.assist-name {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    margin: 0 0 4px;
}
.assist-bubble p {
    margin: 0;
    font-size: 1.22rem;
    font-weight: 500;
    line-height: 1.7;
    color: var(--on-surface);
    overflow-wrap: break-word;
}

/* 웰컴 화면의 큰 도우미 */
.assist--hero { margin-bottom: 36px; }
.assist--hero .assist-avatar {
    width: 96px;
    height: 96px;
    background: var(--primary-container);
}
.assist--hero .assist-avatar .ms { font-size: 54px; }
.assist--hero .assist-bubble p {
    font-size: 1.35rem;
    font-weight: 700;
}

/* ---------- 웰컴: 초대형 카드 ---------- */
.home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}
.home-card--wide { grid-column: 1 / -1; }
.home-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: var(--white);
    border: 1px solid var(--outline-variant);
    border-radius: 1.75rem;
    padding: 36px 24px;
    text-decoration: none;
    color: var(--on-surface);
    text-align: center;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.home-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.home-card:active { transform: scale(0.97); }
.hc-icon {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.hc-icon .ms { font-size: 52px; vertical-align: 0; }
.hc-icon--indigo { background: var(--primary-fixed);     color: var(--primary); }
.hc-icon--green  { background: var(--secondary-container); color: var(--secondary); }
.hc-icon--red    { background: var(--error-container);   color: var(--on-error-container); }
.hc-icon--gray   { background: var(--surface-high);      color: var(--on-surface-variant); }
.home-card h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.35;
}
.home-card > p {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--on-surface-variant);
}

/* ---------- 문제 해결 대시보드 카드 ---------- */
.help-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 18px;
}
.help-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    background: var(--white);
    border: 1px solid var(--outline-variant);
    border-radius: 1.75rem;
    padding: 26px 28px;
    text-decoration: none;
    color: var(--on-surface);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s, border-color 0.2s, transform 0.15s;
}
.help-card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}
.help-card:active { transform: scale(0.98); }
.help-card h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
    line-height: 1.4;
}
.help-card .hc-go {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0;
    font-size: 1.02rem;
    font-weight: 500;
    color: var(--on-surface-variant);
}

/* 문제 카드/상세의 아이콘 타일 */
.qa-icon {
    width: 64px;
    height: 64px;
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--shadow-sm);
}
.qa-icon .ms { font-size: 34px; vertical-align: 0; }
.qa-icon--red    { background: var(--error-container);     color: var(--on-error-container); }
.qa-icon--green  { background: var(--secondary-container); color: #0c714d; }
.qa-icon--purple { background: var(--primary-fixed);       color: var(--primary-container); }
.qa-icon--gray   { background: var(--surface-high);        color: var(--on-surface); }

/* ---------- 앱 화면 스크린샷 ----------
   패널과 시각적으로 하나의 카드로 이어붙임(인접 형제 선택자) —
   "떠 있는 스크린샷 + 딱딱한 패널"의 단절감을 없애기 위함 */
.shot {
    display: flex;
    justify-content: center;
    margin: 0;
    padding: 26px 20px 22px;
    background: linear-gradient(180deg, var(--surface-low) 0%, var(--white) 100%);
    border: 1px solid var(--outline-variant);
    border-bottom: none;
    border-radius: 1.75rem 1.75rem 0 0;
    box-shadow: var(--shadow-sm);
}
.shot img {
    width: min(300px, 82%);
    height: auto;
    border-radius: 1.1rem;
    box-shadow: 0 6px 20px rgba(30, 0, 169, 0.14), 0 0 0 1px rgba(0, 0, 0, 0.04);
}
.shot + .panel {
    border-top: none;
    border-radius: 0 0 1.75rem 1.75rem;
    box-shadow: var(--shadow-sm);
}

/* 권한 안내: 스크린샷 여러 장 가로 나열 */
.perm-row {
    display: flex;
    gap: 18px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 20px 0 4px;
}
.perm-row figure {
    flex: 1 1 160px;
    max-width: 200px;
    margin: 0;
    text-align: center;
}
.perm-row .perm-img-box {
    width: 100%;
    aspect-ratio: 1440 / 2147;
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    background: var(--white);
}
.perm-row img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}
.perm-row figcaption {
    margin-top: 10px;
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.5;
}

/* ---------- 내용 패널 ---------- */
.panel {
    background: var(--white);
    border: 1px solid var(--outline-variant);
    border-radius: 1.75rem;
    padding: 28px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
}
.panel-title {
    margin: 0 0 12px;
    font-size: 1.4rem;
    font-weight: 800;
    line-height: 1.4;
}
.panel-text {
    margin: 0 0 16px;
    font-size: 1.12rem;
    line-height: 1.8;
}
.panel-list {
    margin: 0;
    padding-left: 24px;
    font-size: 1.08rem;
    line-height: 1.85;
}
.panel-list li { margin-bottom: 8px; }
.panel-list li::marker { color: var(--primary); font-weight: 700; }

/* ---------- 동작 단계: ①②③ 큰 원형 번호 ---------- */
.action-steps {
    list-style: none;
    counter-reset: action;
    margin: 0 0 8px;
    padding: 0;
}
.action-steps li {
    counter-increment: action;
    position: relative;
    padding: 13px 16px 13px 60px;
    margin-bottom: 10px;
    background: linear-gradient(180deg, rgba(226, 223, 255, 0.55) 0%, rgba(226, 223, 255, 0.28) 100%);
    border: 1px solid rgba(30, 0, 169, 0.08);
    border-radius: 1.1rem;
    font-size: 1.12rem;
    line-height: 1.7;
}
.action-steps li::before {
    content: counter(action);
    position: absolute;
    left: 13px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-container) 100%);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 800;
    box-shadow: 0 2px 6px rgba(30, 0, 169, 0.3);
}

/* ---------- 앱 버튼 모양 칩 ---------- */
.btn-label {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    font-weight: 700;
    font-size: 0.95em;
    padding: 3px 14px;
    border-radius: 12px;
    white-space: nowrap;
    vertical-align: baseline;
    line-height: 1.5;
}
.btn-label--danger { background: var(--error); }

/* ---------- 성공 확인 박스 ---------- */
.check-box {
    margin-top: 18px;
    background: rgba(154, 242, 197, 0.35);
    border: 2px solid var(--secondary);
    border-radius: 1.25rem;
    padding: 16px 20px;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--on-secondary-dark);
    line-height: 1.7;
}
.check-box::before {
    content: "check_circle";
    font-family: 'Material Symbols Outlined';
    font-variation-settings: 'FILL' 1;
    font-size: 1.3em;
    vertical-align: -0.28em;
    margin-right: 8px;
    color: var(--secondary);
}

/* ---------- 안내 박스 3단계: 도움말 / 주의 / 절대 금지 ----------
   도우미가 옆에서 말을 걸어주는 느낌으로 통일 — 굵은 좌측 스트라이프
   (문서/관리자 패널 톤) 대신, 라벨을 둥근 칩으로 만들어 버튼 칩·
   말풍선과 같은 시각 언어를 씀 */
.note-info, .note-warn, .note-danger {
    margin-top: 14px;
    border-radius: 1.25rem;
    padding: 14px 18px;
    font-size: 1.05rem;
    line-height: 1.75;
}
.note-info strong,
.note-warn strong,
.note-danger strong {
    display: flex;
    width: fit-content;
    align-items: center;
    gap: 4px;
    padding: 3px 12px 3px 8px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.9em;
    margin-bottom: 8px;
    white-space: nowrap;
}
.note-info strong::before,
.note-warn strong::before,
.note-danger strong::before {
    font-family: 'Material Symbols Outlined';
    font-variation-settings: 'FILL' 1;
    font-size: 1.2em;
}
.note-info {
    background: rgba(226, 223, 255, 0.45);
    border: 1px solid rgba(53, 37, 205, 0.12);
    color: #1d1160;
}
.note-info strong { background: rgba(255, 255, 255, 0.7); color: var(--primary-container); }
.note-info strong::before { content: "lightbulb"; }
.note-info a { color: var(--primary-container); font-weight: 700; }

.note-warn {
    background: #fff7ec;
    border: 1px solid rgba(224, 138, 0, 0.25);
    color: #8a5500;
}
.note-warn strong { background: rgba(255, 255, 255, 0.7); color: #c67a00; }
.note-warn strong::before { content: "warning"; }
.note-warn a { color: #c67a00; font-weight: 700; }

.note-danger {
    background: var(--error-container);
    border: 2px solid var(--error);
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--on-error-container);
}
.note-danger strong { background: rgba(255, 255, 255, 0.55); color: var(--error); }
.note-danger strong::before { content: "report"; }

/* ---------- 안전 수칙 목록 ---------- */
.safety-list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.safety-list li {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px 18px;
    margin-bottom: 12px;
    background: rgba(255, 218, 214, 0.45);
    border: 1px solid rgba(186, 26, 26, 0.35);
    border-radius: 1.25rem;
    font-size: 1.12rem;
    font-weight: 600;
    line-height: 1.7;
    color: var(--on-error-container);
}
.safety-list .safety-icon {
    flex-shrink: 0;
    font-size: 1.6em;
    color: var(--error);
    margin-top: 2px;
    vertical-align: 0;
}

/* ---------- 위저드 이동 버튼 ---------- */
.wiz {
    display: flex;
    gap: 14px;
    align-items: stretch;
    margin-top: 28px;
}
.btn-big {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 68px;
    padding: 16px 22px;
    border-radius: 999px;
    border: 2px solid transparent;
    font: inherit;
    font-size: 1.25rem;
    font-weight: 800;
    text-decoration: none;
    cursor: pointer;
    text-align: center;
    line-height: 1.4;
    transition: background-color 0.2s, border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-big:active { transform: scale(0.96); }
.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.btn-primary:hover { background: var(--primary-container); border-color: var(--primary-container); }
.btn-green {
    background: var(--secondary);
    border-color: var(--secondary);
    color: #fff;
    box-shadow: var(--shadow-md);
}
.btn-ghost {
    background: var(--white);
    border-color: var(--outline-variant);
    color: var(--on-surface);
}
.btn-ghost:hover { background: var(--surface-container); border-color: var(--primary); }
.wiz .btn-ghost { flex: 0 1 34%; }

.progress-label {
    display: block;
    width: fit-content;
    margin: 16px auto 0;
    padding: 6px 18px;
    background: var(--surface-container);
    border-radius: 999px;
    text-align: center;
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--on-surface-variant);
    letter-spacing: 0.02em;
}

/* ---------- 완료 축하 화면 ---------- */
.done-hero {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    background: var(--white);
    border: 1px solid var(--outline-variant);
    border-radius: 1.75rem;
    padding: 44px 28px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
}
.done-hero .done-check {
    width: 108px;
    height: 108px;
    border-radius: 50%;
    background: var(--secondary);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 20px;
    box-shadow: var(--shadow-md);
}
.done-hero .done-check .ms { font-size: 64px; vertical-align: 0; }
.done-hero h2 {
    margin: 0 0 10px;
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--secondary);
}
.done-hero p {
    margin: 0;
    font-size: 1.15rem;
    color: var(--on-surface-variant);
}

/* ---------- 데스크톱 ---------- */
@media (min-width: 720px) {
    .help-grid { grid-template-columns: 1fr 1fr; }
}

/* ---------- 모바일(≤480px) ---------- */
@media (max-width: 480px) {
    body { font-size: 18px; }
    .stage { padding: 92px 14px 60px; }
    .topbar { height: 64px; }
    .topbar-title { font-size: 1rem; }
    .topbar-btn { font-size: 0.92rem; padding: 8px 10px; }

    .assist { gap: 12px; }
    .assist-avatar { width: 56px; height: 56px; }
    .assist-avatar .ms { font-size: 30px; }
    .assist-bubble { padding: 16px 18px; }
    .assist-bubble p { font-size: 1.1rem; }
    .assist--hero .assist-avatar { width: 72px; height: 72px; }
    .assist--hero .assist-avatar .ms { font-size: 40px; }
    .assist--hero .assist-bubble p { font-size: 1.18rem; }

    .home-grid { gap: 14px; }
    .home-card { padding: 22px 14px; gap: 10px; }
    .hc-icon { width: 64px; height: 64px; }
    .hc-icon .ms { font-size: 36px; }
    .home-card h2 { font-size: 1.1rem; }
    .home-card > p { font-size: 0.9rem; }

    .panel { padding: 22px 18px; border-radius: 1.5rem; }
    .panel-title { font-size: 1.25rem; }
    .action-steps li { padding: 10px 12px 10px 52px; font-size: 1.05rem; }
    .action-steps li::before { width: 30px; height: 30px; font-size: 1rem; }

    .btn-big { min-height: 60px; font-size: 1.1rem; padding: 14px 14px; }
    .help-card { padding: 22px; }
    .help-card h2 { font-size: 1.2rem; }

    /* 좁은 화면에서는 버튼 2개를 한 줄에 욱여넣지 않고 전체 폭으로 쌓음
       (주 행동 버튼을 위로, 뒤로/홈 버튼을 아래로) */
    .wiz {
        flex-direction: column-reverse;
        gap: 12px;
    }
    .wiz .btn-ghost { flex: 1 1 auto; }
}

/* ---------- 초소형 화면(≤360px, iPhone SE 등) ---------- */
@media (max-width: 360px) {
    .stage { padding: 88px 12px 56px; }
    .assist { gap: 10px; }
    .assist-avatar { width: 48px; height: 48px; }
    .assist-avatar .ms { font-size: 26px; }
    .assist-bubble { padding: 14px 16px; }
    .assist-bubble p { font-size: 1.02rem; }
    .assist--hero .assist-avatar { width: 64px; height: 64px; }
    .assist--hero .assist-bubble p { font-size: 1.08rem; }

    .panel { padding: 18px 14px; }
    .home-grid { gap: 10px; }
    .home-card { padding: 18px 10px; gap: 8px; }
    .hc-icon { width: 56px; height: 56px; }
    .hc-icon .ms { font-size: 32px; }
    .home-card h2 { font-size: 1rem; }
    .home-card > p { font-size: 0.82rem; }

    .btn-big { font-size: 1.02rem; padding: 12px; }
}
