:root {
    --bg-color: #ffffff;
    --text-color: #333333;
    --header-bg: #f8f9fa;
    --border-color: #e9ecef;
    --accent-color: #007bff;
    --secondary-text: #6c757d;
    --item-hover-bg: #f1f3f5;
    --source-badge-bg: #f1f3f5;
    --source-badge-text: #868e96;
}

[data-theme="dark"] {
    --bg-color: #121212;
    --text-color: #e0e0e0;
    --header-bg: #1e1e1e;
    --border-color: #333333;
    --accent-color: #4dabf7;
    --secondary-text: #adb5bd;
    --item-hover-bg: #2c2c2c;
    --source-badge-bg: #2c2c2c;
    --source-badge-text: #adb5bd;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans CJK KR", "Malgun Gothic", sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    margin: 0;
    padding: 0;
    transition: background-color 0.3s, color 0.3s;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

/* Header */
.site-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.site-logo {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0;
}

.site-logo a {
    color: var(--text-color);
    text-decoration: none;
    transition: color 0.3s;
}

.site-logo a:hover {
    color: var(--accent-color);
}

.header-right {
    display: flex;
    gap: 10px;
    align-items: center;
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1.2rem;
    padding: 4px;
    border-radius: 50%;
    transition: background-color 0.2s;
    color: var(--text-color);
}

.btn-icon:hover {
    background-color: var(--item-hover-bg);
}

[data-theme="dark"] .icon-sun {
    display: inline;
}

[data-theme="dark"] .icon-moon {
    display: none;
}

[data-theme="light"] .icon-sun {
    display: none;
    flex-direction: column;
    gap: 12px;
}

.deal-item {
    display: flex;
    flex-direction: column;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background-color: var(--bg-color);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
}

.deal-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background-color: var(--item-hover-bg);
}

.deal-main {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
    /* Prevent flex item from overflowing */
    margin-bottom: 8px;
    /* Spacing for mobile column layout */
}

.deal-source {
    font-size: 0.75rem;
    color: var(--text-color);
    line-height: 1.4;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

@media (max-width: 600px) {
    .deal-title {
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: normal;
        min-height: 2.8em;
        max-height: 2.8em;
    }
}

.deal-title a {
    text-decoration: none;
    color: inherit;
    transition: color 0.2s;
}

.deal-title a:hover {
    color: var(--accent-color);
}

/* Visited Link Style */
.deal-item.visited {
    opacity: 0.6;
}

.deal-item.visited .deal-title a {
    color: #888;
}

.deal-time {
    font-size: 0.8rem;
    color: #999;
    font-weight: 400;
    white-space: nowrap;
}

.loading {
    text-align: center;
    padding: 40px;
    color: var(--secondary-text);
}

.no-deals {
    text-align: center;
    padding: 40px;
    color: var(--secondary-text);
}

.error {
    text-align: center;
    padding: 40px;
    color: #dc3545;
}

/* Footer */
.site-footer {
    margin-top: 40px;
    padding: 20px 0;
    text-align: center;
    color: var(--secondary-text);
    font-size: 0.9rem;
    border-top: 1px solid var(--border-color);
}

/* Responsive */
@media (min-width: 600px) {
    .deal-item {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
    }

    .deal-main {
        margin-bottom: 0;
    }

    .deal-meta {
        display: flex;
        flex-direction: column;
        align-items: flex-end;
        min-width: 100px;
        margin-left: 16px;
    }
}

/* Mobile adjustments */
@media (max-width: 480px) {
    .site-header {
        flex-wrap: wrap;
        gap: 10px;
    }

    .header-left {
        width: 100%;
        text-align: center;
        margin-bottom: 5px;
    }

    .header-right {
        width: 100%;
        justify-content: center;
    }
}

/* Tab Styles */
.tabs {
    display: flex;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-btn {
    padding: 10px 20px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-color);
    opacity: 0.6;
    transition: all 0.3s ease;
}

.tab-btn:hover {
    opacity: 1;
    background-color: rgba(0,0,0,0.05);
}

.tab-btn.active {
    opacity: 1;
    border-bottom: 2px solid var(--accent-color);
    color: var(--accent-color);
    margin-bottom: -2px; /* Overlap border */
}

.tab-content {
    display: none;
    animation: fadeIn 0.3s ease;
}

.tab-content.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}
/* ───────────── 메인 화면 (D-007 알림 중심형) ─────────────
   index.html 전용. .app-body 아래에서만 쓰는 클래스라 관리자·로그인 화면에는 영향 없음.
   색: 주황(--app-brand)이 서비스 대표색. 흰 글씨가 올라가는 곳은 더 진한 --app-hot(대비 4.5:1 이상). */
:root {
    --app-text: #1c1917;
    --app-muted: #6b6460;
    --app-surface: #f7f3ef;
    --app-line: #ede7e1;
    --app-brand: #e8590c;
    --app-hot: #c2410c;
    --app-on-hot: #ffffff;
    --app-price: #c2410c;
    --app-match-bg: #fff4ec;
    --app-match-line: #ffd8bf;
    --app-badge-bg: #f1ece7;
    --app-badge-text: #57534e;
    --app-ok: #1f7a43;
}

[data-theme="dark"] {
    --app-text: #ede7e1;
    --app-muted: #a8a29e;
    --app-surface: #1c1917;
    --app-line: #2c2724;
    --app-brand: #ff8a4c;
    --app-hot: #fb923c;
    --app-on-hot: #1a1a1a;
    --app-price: #fdba74;
    --app-match-bg: #26170e;
    --app-match-line: #4a2a16;
    --app-badge-bg: #2a2522;
    --app-badge-text: #d6d0ca;
    --app-ok: #86e0a6;
}

.app-body {
    font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Noto Sans KR", "Noto Sans CJK KR", "Malgun Gothic", sans-serif;
    color: var(--app-text);
}

.app {
    max-width: 640px;
    margin: 0 auto;
    padding: 0 16px calc(84px + env(safe-area-inset-bottom));
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 0 6px;
}

.app-logo {
    margin: 0;
    font-size: 1.375rem;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.app-logo a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--app-brand);
    text-decoration: none;
    white-space: nowrap;
}

/* 로고 마크(카트) — 다크 모드에선 선 색을 밝게 만든 파일(logo-mark-dark.png)로 바꿔 보인다 */
.app-logo-mark {
    display: block;
    width: auto;
    height: 32px;
}

.app-logo-mark.is-dark {
    display: none;
}

[data-theme="dark"] .app-logo-mark {
    display: none;
}

[data-theme="dark"] .app-logo-mark.is-dark {
    display: block;
}

.app-header-right {
    display: flex;
    align-items: center;
}

/* 좁은 폰(340px 이하)에선 "방금 수집"을 숨겨 로고가 줄바꿈되지 않게 */
@media (max-width: 340px) {
    .app-updated {
        display: none;
    }
}

.app-updated {
    font-size: 0.75rem;
    color: var(--app-muted);
    margin-right: 4px;
    white-space: nowrap;
}

.icon-btn {
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: none;
    color: var(--app-text);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.icon-btn:hover {
    background-color: var(--app-surface);
    color: var(--app-brand);
}

.section-title,
.view-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}

.view-title {
    font-size: 1.125rem;
    padding: 8px 0 14px;
}

.section-head {
    display: flex;
    align-items: center;
    gap: 8px;
}

.new-count {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 10px;
    background: var(--app-hot);
    color: var(--app-on-hot);
}

/* 키워드에 걸린 딜: 연주황 카드로 강조 */
.matched-card {
    margin-top: 6px;
    padding: 14px 16px 4px;
    border-radius: 14px;
    background: var(--app-match-bg);
    border: 1px solid var(--app-match-line);
}

.matched-card .deal-row {
    border-bottom-color: var(--app-match-line);
}

.matched-card .deal-row:last-child {
    border-bottom: none;
}

/* 딜 목록 */
.deal-section {
    padding-top: 22px;
}

.deal-rows {
    display: flex;
    flex-direction: column;
}

.deal-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--app-line);
    color: inherit;
    text-decoration: none;
}

.row-main {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 4px;
    min-width: 0;
}

/* 썸네일 (E-019): 이미지 주소만 받아 원래 서버에서 불러옴. 없거나 깨지면 쇼핑몰 이름(최대 6자·2줄) */
.row-thumb {
    position: relative;
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    background: var(--app-badge-bg);
    color: var(--app-badge-text);
    font-size: 0.6875rem;
    font-weight: 700;
    line-height: 1.2;
    padding: 0 8px;
    text-align: center;
    word-break: break-all;
}

.row-thumb {
    background-image: url("/images/thumb-placeholder.png");
    background-repeat: no-repeat;
    background-position: center 6px;
    background-size: 28px 28px;
    align-items: flex-end;
    padding-bottom: 6px;
}

.matched-card .row-thumb {
    background-position: center 3px;
    background-size: 18px 18px;
    white-space: nowrap;
    text-overflow: ellipsis;
    word-break: normal;
}

.row-thumb img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* 메인 화면 로딩·오류 문구 (T-119): 옛 색 대신 앱 토큰. 관리자·land는 그대로 */
.app-body .loading {
    color: var(--app-muted);
}

.app-body .error {
    color: var(--app-text);
}

.app-body .error .primary-btn {
    display: block;
    margin: 12px auto 0;
}

/* 첫 로딩 가짜 행 (T-118): 애니메이션 없음 */
.skeleton-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--app-line);
}

.skeleton-thumb {
    flex: none;
    width: 64px;
    height: 64px;
    border-radius: 10px;
    background: var(--app-badge-bg);
}

.skeleton-line {
    display: block;
    width: 70%;
    height: 12px;
    margin: 6px 0;
    border-radius: 6px;
    background: var(--app-badge-bg);
}

.skeleton-line.is-short {
    width: 45%;
}

.matched-card .row-thumb {
    box-sizing: border-box;
    display: block;
    width: 68px;
    height: 52px;
    padding: 31px 2px 0;
}

.row-past {
    margin-top: 2px;
    font-size: 0.75rem;
    color: var(--app-muted);
}

.row-past.is-lower {
    color: var(--app-ok);
}

.deal-row:hover .row-title {
    color: var(--app-hot);
}

.deal-row.visited {
    opacity: 0.5;
}

.row-top {
    display: flex;
    flex-wrap: wrap; /* 카테고리 글자가 붙어 메타가 길면 시간이 말줄임에 가려지지 않게 다음 줄로 */
    align-items: center;
    gap: 2px 6px;
    min-width: 0;
}

.kw-badge {
    flex: none;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px var(--app-brand); /* 테두리를 안쪽 그림자로 — store-badge와 높이·안쪽 여백이 같다 */
    background: transparent;
    color: var(--app-hot);
}

.store-badge {
    flex: none;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 6px;
    background: var(--app-badge-bg);
    color: var(--app-badge-text);
}

.store-badge.free-ship {
    font-weight: 500;
}

.row-meta {
    min-width: 0;
    font-size: 0.75rem;
    color: var(--app-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.row-body {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.row-title {
    flex: 1;
    font-size: 0.9375rem;
    line-height: 1.45;
    min-width: 0;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.row-price {
    flex: none;
    min-width: 56px;
    text-align: right;
    margin-left: auto;
    font-size: 0.9375rem;
    font-weight: 700;
    white-space: nowrap;
    color: var(--app-price);
}

.row-unit {
    margin-top: 2px;
    text-align: right;
    font-size: 0.75rem;
    line-height: 1.3;
    color: var(--app-muted);
}

.day-label {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 16px 0 0;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--app-text);
}

.day-label::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--app-brand);
}

.empty-note {
    margin: 10px 0 12px;
    font-size: 0.875rem;
    color: var(--app-muted);
    list-style: none;
}

.empty-note .primary-btn {
    display: block;
    margin-top: 10px;
}

.more-btn,
.primary-btn {
    min-height: 44px;
    padding: 0 18px;
    border-radius: 10px;
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
}

.more-btn {
    width: 100%;
    margin-top: 14px;
    border: 1px solid var(--app-match-line);
    background: var(--app-match-bg);
    color: var(--app-hot);
}

.primary-btn {
    border: none;
    background: var(--app-hot);
    color: var(--app-on-hot);
}

.primary-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 검색 */
.search-field {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 48px;
    margin-top: 6px;
    padding: 0 14px;
    border-radius: 12px;
    background: var(--app-surface);
    border: 1px solid var(--app-line);
    color: var(--app-brand);
}

.search-field:focus-within {
    border-color: var(--app-brand);
}

.search-field input {
    flex: 1;
    min-width: 0;
    border: none;
    background: none;
    font: inherit;
    font-size: 1rem;
    color: var(--app-text);
    outline: none;
}

.search-field #search-input {
    padding: 0;
}

/* 검색창 지우기 X: 브라우저 기본(파랑) 대신 보조 글자색 */
.search-field input[type="search"]::-webkit-search-cancel-button {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    background: var(--app-muted);
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 6l12 12M18 6 6 18'/%3E%3C/svg%3E") center / contain no-repeat;
}

.search-count {
    margin: 12px 0 0;
    font-size: 0.8125rem;
    color: var(--app-muted);
}

/* 알림 탭 키워드 미리보기(E-025): 비어 있어도 높이를 예약해 입력 중 화면이 흔들리지 않게 */
.kw-preview {
    min-height: 44px;
    margin-top: 4px;
    display: flex;
    align-items: center;
    line-height: 1.4;
}

/* 비어 있고 입력창에 포커스가 없으면 자리를 접는다(E-040②). 입력 중(포커스)엔 예약 유지 → 목록 안 흔들림 */
.kw-form:not(:focus-within) ~ .kw-preview:empty {
    min-height: 0;
    margin: 0;
}

/* 앞 문구는 줄바꿈 없이 */
.kw-preview .kw-preview-lead {
    flex-shrink: 0;
    white-space: nowrap;
}

/* 예시 제목은 한 줄 말줄임: 미리보기가 1줄(44px)로 고정돼 입력 중 아래 목록이 흔들리지 않는다 */
.kw-preview .kw-preview-ex {
    flex: 0 1 auto;
    min-width: 0;
    min-height: 44px;
    padding: 0 4px;
    text-align: left;
    font-weight: 400;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 검색 결과 줄: 건수(왼쪽) + "이 검색어로 알림 받기"(오른쪽, 44px) */
.search-count-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 8px;
}

.search-count-row .search-count {
    flex: 1;
    min-width: 0;
    align-self: center;
    margin-top: 0;
}

.search-count-row .search-alert-btn {
    flex: none;
    min-height: 44px;
    padding: 0 4px;
    font-size: 0.8125rem;
    text-decoration: none;
}

.search-count-row .search-alert-btn:disabled {
    color: var(--app-muted);
    text-decoration: none;
    cursor: default;
}

.search-alert-btn[hidden],
.search-alert-empty[hidden] {
    display: none;
}

.search-alert-empty {
    display: block;
    width: 100%;
    margin-top: 8px;
}

/* 알림 탭: 키워드 등록 + 목록 */
.kw-form {
    display: flex;
    gap: 8px;
}

.kw-form input {
    flex: 1;
    min-width: 0;
    min-height: 48px;
    padding: 0 14px;
    box-sizing: border-box;
    border: 1px solid var(--app-line);
    border-radius: 12px;
    background: var(--app-surface);
    color: var(--app-text);
    font: inherit;
    font-size: 1rem;
    outline: none;
}

.kw-form input:focus {
    border-color: var(--app-brand);
}

.kw-form .primary-btn {
    min-height: 48px;
    border-radius: 12px;
}

.kw-manage-list {
    list-style: none;
    margin: 14px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
}

.kw-manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-left: 2px;
    border-bottom: 1px solid var(--app-line);
    font-size: 0.9375rem;
    font-weight: 500;
}

.kw-manage-item .icon-btn {
    flex-shrink: 0;
}

.kw-manage-item .kw-name::before {
    content: "#";
    margin-right: 4px;
    color: var(--app-brand);
    font-weight: 700;
}

.push-line {
    display: flex;
    align-items: center;
    gap: 6px;
    justify-content: space-between;
    margin: 12px 0 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background-color: var(--app-surface);
    font-size: 0.8125rem;
}

.push-line .text-btn {
    min-height: 44px;
}

.push-state {
    color: var(--app-muted);
}

.push-line.is-blocked {
    padding-left: 10px;
    border-left: 3px solid var(--app-hot);
}

.push-line.is-blocked .push-state {
    color: var(--app-text);
    font-weight: 600;
}

.push-line .push-fix-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.push-line .push-fix-btn[hidden] {
    display: none;
}

.push-state.is-on {
    color: var(--app-ok);
    font-weight: 700;
}

.text-btn {
    min-height: 32px;
    padding: 0 6px;
    border: none;
    background: none;
    font: inherit;
    font-weight: 700;
    color: var(--app-hot);
    text-decoration: underline;
    cursor: pointer;
}

.kw-note {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: var(--app-muted);
}

/* "알림이 안 와요?" 도움말(E-042①): 기본 접힘, summary 터치 44px */
.push-help {
    margin: 8px 0 0;
    font-size: 0.8125rem;
    color: var(--app-muted);
}

.push-help summary {
    display: flex;
    align-items: center;
    min-height: 44px;
    padding: 0 4px;
    color: var(--app-text);
    font-weight: 700;
    cursor: pointer;
}

/* 펼칠 수 있다는 표시(기본 마커는 flex라 사라짐) */
.push-help summary::after {
    content: "";
    width: 7px;
    height: 7px;
    margin: -3px 0 0 8px;
    border: solid var(--app-muted);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.push-help[open] summary::after {
    margin-top: 3px;
    transform: rotate(-135deg);
}

.push-help summary::-webkit-details-marker {
    display: none;
}

.push-help-img {
    display: block;
    width: 120px;
    height: auto;
    margin: 4px auto 8px;
}

.push-help-list {
    margin: 0 0 8px;
    padding: 0 0 0 20px;
    line-height: 1.55;
}

.push-help-list li {
    margin: 0 0 8px;
}

.push-help-list strong {
    color: var(--app-text);
}

/* 이 기기 점검표(E-042②) */
.push-check-title {
    margin: 12px 0 4px;
    font-size: 0.8125rem;
    color: var(--app-text);
}

.push-check {
    margin: 0;
    padding: 0;
    list-style: none;
}

.push-check-row {
    display: flex;
    gap: 8px;
    padding: 6px 0;
    line-height: 1.5;
}

.push-check-mark {
    flex: none;
    width: 1.25em;
    font-weight: 700;
    text-align: center;
}

.push-check-row.is-ok .push-check-mark {
    color: var(--app-ok);
}

.push-check-row.is-bad .push-check-mark {
    color: var(--app-hot);
}

.push-check-body {
    min-width: 0;
    flex: 1;
}

.push-check-label {
    display: block;
    color: var(--app-text);
}

.push-check-hint {
    display: block;
}

.push-test {
    margin: 4px 0 8px;
}

.push-test-btn {
    min-height: 44px;
}

.push-test-note {
    margin: 0;
}

.site-links {
    margin: 20px 0 0;
    text-align: center;
    font-size: 0.75rem;
}

.site-links a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 12px;
    color: var(--app-muted);
}

/* /hot 서버 렌더 페이지(E-047): functions/_lib/hot-html.js 전용 */
.hot-page h1 {
    margin: 8px 0 12px;
    font-size: 1.375rem;
}

.hot-note,
.hot-time {
    color: var(--app-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.hot-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin: 20px 0 12px;
}

.hot-actions .more-btn {
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 0;
    text-decoration: none;
}

/* 새 목록 받았어요 버튼(E-036): 스크롤을 내려 읽는 중일 때만 위에 고정 */
.new-list-btn {
    position: fixed;
    top: calc(8px + env(safe-area-inset-top, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    max-width: calc(100% - 32px);
    white-space: nowrap;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}

.new-list-btn[hidden] {
    display: none;
}

/* 하단 메뉴 */
.bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    max-width: 640px;
    margin: 0 auto;
    padding-bottom: env(safe-area-inset-bottom);
    border-top: 1px solid var(--app-line);
    background: var(--bg-color);
}

.nav-btn {
    position: relative;
    height: 58px;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.75rem;
    color: var(--app-muted);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    cursor: pointer;
}

.nav-btn[aria-current="page"] {
    color: var(--app-hot);
    font-weight: 700;
}

.nav-btn[aria-current="page"]::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 30%;
    right: 30%;
    height: 3px;
    border-radius: 0 0 3px 3px;
    background: var(--app-brand);
}

.app-toast {
    position: fixed;
    left: 50%;
    bottom: calc(80px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    padding: 10px 16px;
    border-radius: 20px;
    background: var(--app-text);
    color: var(--app-surface);
    font-size: 0.875rem;
    z-index: 100;
}

.app-toast[hidden] {
    display: none;
}

/* 추천 키워드 칩 (알림 탭, 키워드 0개일 때만) */
.kw-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.kw-chips[hidden] {
    display: none;
}

.kw-chip {
    min-height: 36px;
    padding: 0 14px;
    border-radius: 18px;
    border: 1px solid var(--app-match-line);
    background: var(--app-match-bg);
    color: var(--app-hot);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

/* 홈 화면 추가 안내 */
.install-tip {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 6px;
    padding: 4px 4px 4px 14px;
    border-radius: 12px;
    background: var(--app-surface);
    border: 1px solid var(--app-line);
}

.install-tip[hidden] {
    display: none;
}

.install-tip-text {
    flex: 1;
    margin: 0;
    font-size: 0.8125rem;
    color: var(--app-text);
}

/* 앱 안 브라우저 안내(E-042③): 같은 모양, 아래에 버튼 줄 */
.install-tip.is-inapp {
    flex-wrap: wrap;
    padding-top: 10px;
}

.install-tip-actions {
    flex-basis: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    padding: 0 0 4px;
}

.install-tip-actions .text-btn {
    min-height: 44px;
}

.install-tip .primary-btn {
    flex: none;
    min-height: 36px;
    padding: 0 14px;
}

/* 검색 정렬 토글 + 필터 버튼 한 줄 (E-023) */
.sort-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
}

.sort-toggle {
    display: flex;
    gap: 8px;
}

.sort-row[hidden],
.sort-toggle[hidden],
.filter-toggle[hidden] {
    display: none;
}

.sort-btn {
    min-height: 44px;
    padding: 0 14px;
    border-radius: 22px;
    border: 1px solid var(--app-line);
    background: var(--app-surface);
    color: var(--app-muted);
    font: inherit;
    font-size: 0.875rem;
    cursor: pointer;
}

.sort-btn[aria-pressed="true"] {
    border-color: var(--app-match-line);
    background: var(--app-match-bg);
    color: var(--app-hot);
    font-weight: 700;
}

/* 검색 둘러보기 칩 (쇼핑몰·출처) — 정렬 토글 칩과 같은 모양, 가로 스크롤 */
.browse-chips {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    padding-bottom: 2px;
    overflow-x: auto;
    scrollbar-width: none;
}

.browse-chips .recent-clear {
    flex: none;
    min-height: 44px;
    margin: -6px 0 -2px;
    align-self: center;
    white-space: nowrap;
    font-size: 0.8125rem;
    font-weight: 400;
    color: var(--app-muted);
}

.chip-label {
    flex: none;
    align-self: center;
    font-size: 0.8125rem;
    color: var(--app-muted);
}

.browse-chips::-webkit-scrollbar {
    display: none;
}

.browse-chips[hidden] {
    display: none;
}

.browse-chip {
    flex: none;
    min-height: 44px;
    padding: 0 14px;
    border-radius: 22px;
    border: 1px solid var(--app-line);
    background: var(--app-surface);
    color: var(--app-muted);
    font: inherit;
    font-size: 0.875rem;
    white-space: nowrap;
    cursor: pointer;
}

.browse-chip[aria-pressed="true"] {
    border-color: var(--app-match-line);
    background: var(--app-match-bg);
    color: var(--app-hot);
    font-weight: 700;
}

/* 샀어요 버튼 (E-002): 딜 행 아래 오른쪽. 링크 밖 형제 요소라 행 선과 방문 흐림은 .deal-entry이 맡는다 */
.deal-entry {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid var(--app-line);
}

.deal-entry .deal-row {
    border-bottom: none;
}

.matched-card .deal-entry {
    border-bottom-color: var(--app-match-line);
}

.matched-card .deal-entry:last-child {
    border-bottom: none;
}

/* 딜 행 아래 버튼 줄(링크 밖 형제): 오른쪽 샀어요. E-014 공유·E-027 저장 버튼이 왼쪽에 붙는다 */
.entry-foot {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    margin-top: -12px;
}

.entry-foot .buy-btn {
    margin-top: 0;
    margin-left: auto;
}

.entry-foot .share-deal-btn {
    margin-left: -10px;
    color: var(--app-muted);
}

.entry-foot .save-deal-btn {
    margin-left: 0;
    color: var(--app-muted);
}

.entry-foot .save-deal-btn[aria-pressed="true"] {
    color: var(--app-brand);
}

.entry-foot .save-deal-btn[aria-pressed="true"] svg {
    fill: currentColor;
}

.others-toggle {
    min-height: 44px;
    margin-left: 76px;
    padding: 0 16px 0 0;
    font-size: 0.8125rem;
    font-weight: 500;
    text-decoration: none;
    color: var(--app-muted);
}

.shared-card .section-head {
    justify-content: space-between;
    margin-bottom: 4px;
}

.shared-card .section-head .icon-btn {
    margin-right: -10px;
    color: var(--app-muted);
}

.entry-foot .others-toggle {
    margin-left: 0;
}

.others-list {
    display: flex;
    flex-direction: column;
    padding: 0 0 8px 76px;
}

.others-list[hidden] {
    display: none;
}

.other-row {
    display: flex;
    align-items: center;
    min-height: 44px;
    color: var(--app-muted);
    font-size: 0.8125rem;
    text-decoration: none;
}

.other-row::after {
    content: '↗';
    margin-left: 4px;
}

.buy-btn {
    align-self: flex-end;
    min-height: 44px;
    margin-top: -12px;
    padding: 0 4px 0 16px;
    border: none;
    background: transparent;
    color: var(--app-muted);
    font: inherit;
    font-size: 0.8125rem;
    cursor: pointer;
}

.buy-btn[hidden] {
    display: none;
}

/* 누군가 누른 딜(숫자 있음)은 주황으로 "첫 번째로 남기기"(회색)보다 눈에 띄게, 내가 누른 딜은 ✓ + 더 굵게 */
.buy-btn.has {
    color: var(--app-hot);
    font-weight: 600;
}

.buy-btn.on {
    color: var(--app-hot);
    font-weight: 700;
}

.buy-btn:disabled {
    opacity: 0.5;
}

/* 홈 걸린 딜 카드 (E-005): 새 딜 행 표시, 모두 보기 버튼 */
.deal-row.is-new .row-title {
    font-weight: 700;
}

.deal-row.is-new .row-title::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    margin-right: 6px;
    border-radius: 50%;
    vertical-align: middle;
    background: var(--app-brand);
}

.matched-toggle {
    display: block;
    width: 100%;
    min-height: 44px;
    margin-top: 4px;
    text-align: center;
}

/* 알림 탭 키워드 행: 5일 N건 (삭제 버튼 앞, 오른쪽 정렬) */
.kw-manage-item .kw-main {
    display: flex;
    flex-direction: column;
    margin-right: auto;
    min-width: 0;
}

.kw-manage-item .kw-name {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kw-manage-item .kw-sub {
    font-size: 0.75rem;
    font-weight: 400;
    line-height: 1.4;
    color: var(--app-muted);
}

.kw-count:is(span) {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
}

.kw-help-item {
    list-style: none;
    padding: 8px 2px 4px;
    border-bottom: 1px solid var(--app-line);
}

.kw-help-item .kw-chips {
    margin-top: 8px;
}

.kw-help {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: var(--app-muted);
}

.kw-count:disabled {
    text-decoration: none;
    cursor: default;
}

.kw-count {
    min-height: 44px;
    padding: 0 6px;
    border: none;
    background: none;
    font: inherit;
    font-size: 0.75rem;
    font-weight: 400;
    color: var(--app-muted);
    text-decoration: underline;
    white-space: nowrap;
    flex-shrink: 0;
    cursor: pointer;
}

/* 칩 줄이 옆으로 더 넘어갈 때만 오른쪽 끝을 흐리게 */
.browse-chips.has-more {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}

/* 홈 카테고리 탭 (T-100) — 밑줄 탭, 항상 하나 선택("전체" 기본) */
.cat-tabs {
    display: flex;
    gap: 0;
    margin-top: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    border-bottom: 1px solid var(--app-line);
}

.cat-tabs::-webkit-scrollbar {
    display: none;
}

.cat-tabs[hidden] {
    display: none;
}

.cat-tabs.has-more {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
}

.cat-tab {
    flex: none;
    min-height: 44px;
    padding: 0 12px;
    margin-bottom: -1px;
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: var(--app-muted);
    font: inherit;
    font-size: 0.9375rem;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
}

.cat-tab[aria-selected="true"] {
    color: var(--app-text);
    font-weight: 700;
    border-bottom-color: var(--app-brand);
}

/* 검색 필터 접힘 줄 (E-011⑥) — 칩 모양 재사용 */
.filter-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.filter-bar .browse-chips {
    flex: 1;
    min-width: 0;
    margin-top: 0;
}

.filter-toggle {
    min-height: 44px;
    margin-left: auto;
    border-radius: 22px;
}

.filter-bar[hidden] {
    display: none;
}

/* 검색 탭 빈 상태 (E-023③) */
.search-empty {
    margin-top: 24px;
    text-align: center;
}

.search-empty[hidden] {
    display: none;
}

.search-empty-img {
    display: block;
    width: 160px;
    height: auto;
    margin: 0 auto 12px;
}

.search-empty-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--app-text);
}

.search-empty-sub {
    margin: 4px 0 0;
    font-size: 0.875rem;
    color: var(--app-muted);
}

/* 알림 탭 저장한 딜(E-027) */
.saved-section {
    margin-top: 24px;
}

.saved-section .section-head {
    margin-bottom: 8px;
}

/* 목록에서 내려간 저장 딜(E-027④): 회색 행 + 오른쪽 X */
.deal-row.is-gone {
    opacity: 0.6;
}

.deal-row.is-gone .row-price {
    color: var(--app-muted);
}

.entry-foot .gone-del-btn {
    margin-left: auto;
    color: var(--app-muted);
}

/* 알림 탭 최근 받은 알림(E-028) */
.recent-push {
    margin-top: 24px;
}

.recent-push .section-head {
    margin-bottom: 8px;
    justify-content: space-between;
}

.recent-push-clear {
    min-height: 44px;
    margin-right: -8px;
    padding: 0 8px;
    font-size: 0.8125rem;
    color: var(--app-muted);
}

.recent-push-more {
    min-height: 44px;
    width: 100%;
    font-size: 0.8125rem;
    color: var(--app-muted);
}

div.recent-row {
    cursor: default;
}

.recent-row:focus-visible {
    outline: 2px solid var(--app-brand);
    outline-offset: 2px;
}

.recent-push-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.recent-item {
    border-bottom: 1px solid var(--app-line);
}

.recent-row {
    display: flex;
    flex-direction: column;
    gap: 2px;
    width: 100%;
    min-height: 44px;
    padding: 10px 0;
    border: none;
    background: none;
    color: var(--app-text);
    font: inherit;
    text-align: left;
    text-decoration: none;
    cursor: pointer;
}

.recent-title {
    font-size: 0.9375rem;
    font-weight: 600;
    overflow-wrap: anywhere;
}

.recent-body {
    font-size: 0.875rem;
    color: var(--app-muted);
    overflow-wrap: anywhere;
}

.recent-time {
    font-size: 0.75rem;
    color: var(--app-muted);
}

/* 홈 전체 목록: 지난 방문 구분선 (E-035) */
.seen-divider {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
    font-size: 12px;
    color: var(--app-muted);
}
.seen-divider::before,
.seen-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--app-line);
}

/* 홈 전체 목록 머리: 새 딜 건수 (E-035) — 주황 .new-count와 헷갈리지 않게 회색 글자 */
.new-meta {
    font-size: 13px;
    color: var(--app-muted);
}
.new-meta[hidden] {
    display: none;
}

/* 딜 상세 시트 (E-039): 아래에서 올라오는 시트. 내용은 script.js가 채움 */
.deal-sheet {
    position: fixed;
    inset: 0;
    z-index: 90;
}
.deal-sheet[hidden] {
    display: none;
}
.sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}
.sheet-panel {
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 100%;
    max-width: 640px;
    max-height: 85vh;
    max-height: 85dvh;
    display: flex;
    flex-direction: column;
    background: var(--bg-color);
    color: var(--app-text);
    border-radius: 16px 16px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    outline: none;
}
.sheet-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 4px 8px 4px 16px;
    border-bottom: 1px solid var(--app-line);
}
.sheet-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
}
.sheet-body {
    overflow-y: auto;
    padding: 12px 16px 16px;
    overscroll-behavior: contain;
}

/* 딜 상세 시트 내용 (E-039③) */
.entry-foot .detail-btn {
    margin-left: auto;
    color: var(--app-muted);
}
.entry-foot .detail-btn + .buy-btn {
    margin-left: 0;
}
.sheet-meta {
    font-size: 0.75rem;
    color: var(--app-muted);
}
.sheet-deal-title {
    margin: 6px 0 4px;
    font-size: 1rem;
    line-height: 1.45;
    word-break: break-word;
}
.sheet-price {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--app-price);
}
.sheet-actions {
    margin-top: 8px;
}
.sheet-actions .share-deal-btn {
    margin-left: -10px;
}
.sheet-sub {
    margin-top: 12px;
    font-size: 0.8125rem;
    font-weight: 700;
}
.sheet-others {
    padding-left: 0;
}
.sheet-open {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 16px;
    text-decoration: none;
}
.sheet-history[hidden] {
    display: none;
}

/* 딜 상세 시트: 같은 제목 딜 가격 기록 (E-039④) */
.sheet-note {
    margin: 6px 0 0;
    font-size: 0.8125rem;
    color: var(--app-muted);
}
.sheet-hist {
    list-style: none;
    margin: 6px 0 0;
    padding: 0;
    font-size: 0.875rem;
}
.sheet-hist li {
    display: flex;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid var(--app-line);
    color: var(--app-muted);
}
.sheet-hist li.is-now {
    color: var(--app-text);
    font-weight: 700;
}

.more-btn:disabled { opacity: 0.6; cursor: default; }

/* 받은 키워드 확인 카드 (E-048) */
.kw-import {
    margin: 0 0 14px;
    padding: 12px;
    border-radius: 12px;
    background-color: var(--app-surface);
}

.kw-import[hidden] {
    display: none;
}

.kw-import-title {
    margin: 0 0 4px;
    font-size: 0.9375rem;
}

.kw-import .kw-chips {
    margin-top: 8px;
}

.kw-chip-static {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    overflow-wrap: anywhere;
    cursor: default;
    border-color: var(--app-line);
    background: transparent;
    color: inherit;
}

.kw-chip-static.is-done {
    border-color: var(--app-line);
    background: transparent;
    color: var(--app-muted);
}

.kw-import-note {
    margin: 10px 0 0;
    font-size: 0.8125rem;
    color: var(--app-muted);
}

.kw-import-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 10px;
}

.kw-import-actions .text-btn {
    min-height: 44px;
}

/* 내 키워드 링크 보내기 (E-048③) */
.kw-share-item {
    list-style: none;
    padding: 4px 0 0;
}

.kw-share-btn {
    min-height: 44px;
    margin-left: -6px;
    color: var(--app-hot);
    font-size: 0.875rem;
    font-weight: 600;
}

.kw-share-note {
    margin: 0;
    font-size: 0.75rem;
    color: var(--app-muted);
}

/* 정보글 /guide/ (E-063): 글 틀 tools/guide-template.html · 목록 public/guide/index.html 전용 */
.guide-crumb {
    margin: 12px 0 0;
    font-size: 0.875rem;
}

.guide-crumb a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    color: var(--app-muted);
}

.guide-page h1 {
    margin: 0 0 8px;
    font-size: 1.375rem;
    line-height: 1.4;
    overflow-wrap: anywhere;
}

.guide-date {
    margin: 0 0 20px;
    font-size: 0.8125rem;
    color: var(--app-muted);
}

.guide-body {
    max-width: 680px;
    font-size: 1rem;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.guide-body p {
    margin: 0 0 1em;
}

.guide-body h2 {
    margin: 1.75em 0 0.6em;
    font-size: 1.125rem;
    line-height: 1.5;
}

.guide-body ul,
.guide-body ol {
    margin: 0 0 1em;
    padding-left: 1.25em;
}

.guide-body figure {
    margin: 1.25em 0;
}

.guide-body figure img {
    display: block;
    max-width: 100%;
    height: auto;
    border-radius: 8px;
}

.guide-body figcaption {
    margin-top: 6px;
    font-size: 0.8125rem;
    color: var(--app-muted);
}

.guide-body .guide-table-wrap {
    overflow-x: auto;
    margin: 0 0 1em;
}

.guide-body table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9375rem;
    line-height: 1.5;
}

.guide-body th,
.guide-body td {
    padding: 8px 10px;
    border: 1px solid var(--app-line);
    text-align: left;
    overflow-wrap: normal;
    word-break: keep-all;
}

.guide-body td:first-child {
    white-space: nowrap;
}

.guide-body th {
    background: var(--app-surface);
}

.guide-list {
    list-style: none;
    margin: 12px 0 0;
    padding: 0;
}

.guide-list li {
    border-bottom: 1px solid var(--app-line);
}

.guide-list a {
    display: block;
    min-height: 44px;
    padding: 12px 0;
    color: var(--app-text);
    text-decoration: none;
}

.guide-list .guide-item-title {
    display: block;
    font-weight: 600;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.guide-list .guide-item-date,
.guide-list .guide-item-sum {
    display: block;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--app-muted);
}

.guide-list .guide-item-sum {
    font-size: 0.875rem;
}

.guide-empty {
    margin: 24px 0;
    color: var(--app-muted);
    text-align: center;
}
