/* =============================================
   アシスト占い — メインスタイル（淡いピンク基調）
   ============================================= */

:root {
    --primary: #d4758c;
    --primary-light: #e8a4b4;
    --primary-dark: #b85a72;
    --primary-bg: #fce8ed;
    --accent: #c9a96e;
    --accent-light: #f0e6d0;

    --bg: #faf5f3;
    --bg-card: #ffffff;
    --bg-card-alt: #fef9f7;
    --bg-input: #f5eff0;

    --text: #4a3540;
    --text-light: #8a7580;
    --text-muted: #b0a0a8;
    --text-white: #ffffff;

    --border: #e8dde0;
    --border-light: #f0e8eb;
    --shadow: rgba(100, 60, 80, 0.08);

    --online: #5cb85c;
    --busy: #f0ad4e;
    --offline: #bbb;

    --star: #f5a623;
    --danger: #d9534f;
    --success: #5cb85c;

    --header-height: 48px;
    --tab-height: 56px;
    --radius: 12px;
    --radius-sm: 8px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, 'Hiragino Sans', 'Hiragino Kaku Gothic ProN', 'Yu Gothic', sans-serif;
    font-size: 14px;
    line-height: 1.6;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a {
    color: var(--primary);
    text-decoration: none;
}

img {
    max-width: 100%;
    height: auto;
}

/* ======= ヘッダー ======= */
.app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--header-height);
    background: var(--primary);
    color: var(--text-white);
    display: flex;
    align-items: center;
    padding: 0 12px;
    z-index: 100;
    box-shadow: 0 1px 4px var(--shadow);
    transition: background 0.3s, box-shadow 0.3s;
}

/* HOME時の淡いヘッダー */
.app-header.header-home {
    background: #fef0f3;
    box-shadow: 0 1px 6px rgba(212, 117, 140, 0.15);
}

.header-back {
    background: none;
    border: none;
    color: var(--text-white);
    font-size: 24px;
    padding: 0 8px;
    cursor: pointer;
    line-height: 1;
}

.header-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.header-actions {
    display: flex;
    gap: 8px;
}

/* ======= メインコンテンツ ======= */
.app-content {
    margin-top: var(--header-height);
    margin-bottom: var(--tab-height);
    min-height: calc(100vh - var(--header-height) - var(--tab-height));
    min-height: calc(100dvh - var(--header-height) - var(--tab-height));
    padding: 0;
}

/* ======= 下部タブナビ ======= */
.tab-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-height);
    background: var(--bg-card);
    display: flex;
    border-top: 1px solid var(--border);
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 10px;
    gap: 2px;
    transition: color 0.2s;
    position: relative;
}

.tab-item.active {
    color: var(--primary);
}

.tab-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    opacity: 0.45;
    transition: opacity 0.2s, filter 0.2s;
}

.tab-item.active .tab-icon {
    opacity: 1;
    filter: brightness(0.85) saturate(1.3);
}

.tab-label {
    font-weight: 500;
}

.tab-item .badge {
    position: absolute;
    top: 4px;
    right: calc(50% - 18px);
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}

/* ======= ローディング ======= */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(250, 245, 243, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.loading-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* ======= トースト ======= */
.toast-container {
    position: fixed;
    top: calc(var(--header-height) + 8px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--text);
    color: var(--text-white);
    padding: 10px 20px;
    border-radius: 20px;
    font-size: 13px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    animation: toastIn 0.3s ease;
    pointer-events: auto;
}

.toast.error {
    background: var(--danger);
}

.toast.success {
    background: var(--success);
}

@keyframes toastIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ======= ユーティリティ ======= */
.hidden {
    display: none !important;
}

.section-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    padding: 16px 16px 8px;
}

.page-section {
    padding: 16px;
}

.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 48px;
    margin-bottom: 12px;
}

.empty-state .empty-img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    margin-bottom: 16px;
}

.empty-state p {
    font-size: 14px;
}

/* スクロール */
.scroll-x {
    display: flex;
    overflow-x: auto;
    gap: 12px;
    padding: 0 16px 8px;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
}

.scroll-x::-webkit-scrollbar {
    display: none;
}

.scroll-x > * {
    scroll-snap-align: start;
    flex-shrink: 0;
}
