:root {
    --theme-color: #00b0ff; /* 1. Defined Variable */
    --theme-text-color: #ffffff; /* 2. Default Text Color (White) */
    --toss-blue: var(--theme-color); /* Linked to theme */
    --toss-blue-light: #e8f3ff;
    --toss-grey-50: #f9fafb;
    --toss-grey-100: #f2f4f6;
    --toss-grey-200: #e5e8eb;
    --toss-grey-300: #b0b8c1;
    --toss-grey-400: #8b95a1;
    --toss-grey-500: #6b7684;
    --toss-grey-600: #4e5968;
    --toss-grey-700: #333d4b;
    --toss-grey-900: #191f28;
    --white: #ffffff;
    --shadow-soft: 0 4px 24px rgba(0, 0, 0, 0.06);
    --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04);
    --font-main: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
    font-family: var(--font-main);
    background-color: var(--toss-grey-100);
    color: var(--toss-grey-900);
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    display: flex;
    justify-content: center;
}

.app-container {
    width: 100%;
    max-width: 500px;
    background-color: var(--white);
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 40px rgba(0,0,0,0.08);
    overflow-y: auto; /* Changed from hidden to auto to allow body scrolling */
}

/* HERO AREA: Blue Background */
.blue-hero-area {
    background-color: var(--theme-color); /* CSS Variable */
    color: var(--theme-text-color); /* Dynamic Text Color (was white) */
    padding: calc(4px + env(safe-area-inset-top)) 10px 25px; /* Added safe-area-inset-top */
    border-bottom-left-radius: 20px;
    border-bottom-right-radius: 20px;
    transition: background-color 0.3s ease, color 0.3s ease; /* Smooth transition */
    position: relative;
    z-index: 10;
}

/* Header adjusted for Blue Background */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 4px; /* Reduced side padding (20->4px) to push items to edges */
    height: 56px; /* Slightly more compact than 60px */
    background-color: transparent; /* Transparent to show blue */
    backdrop-filter: none;
    border-bottom: none;
    z-index: 10;
}

.header-logo-wrapper {
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
}

.header-logo {
    height: 28px; /* Compact size */
    width: auto;
    object-fit: contain;
}

.header-title {
    display: none; /* Hide old title class just in case */
}

.hamburger-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-right: 0; /* Fixed: Removed negative margin (-8px) which might clip it with small header padding */
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.icon-bar {
    width: 20px;
    height: 2px;
    background-color: var(--theme-text-color); /* Dynamic Contrast */
    border-radius: 2px;
}

/* Content Area - shifted down */
.app-content {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(100px + env(safe-area-inset-bottom)); /* Added safe-area-inset-bottom */
    display: flex;
    flex-direction: column;
    gap: 20px;
    background-color: var(--toss-grey-100); /* Changed to Grey to make white cards pop */
}

/* 1. Zodiac Grid - on Blue Background */
.zodiac-section {
    width: 100%;
    background: transparent;
    padding: 0 4px; /* Reduced from 20px to almost 0 (4px for safety) to maximize width */
}

.zodiac-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, auto);
    gap: 15px 8px; /* Vertical: 15px (breathing), Horizontal: 8px (better separation) */
}

.zodiac-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: none;
    border: none;
    cursor: pointer;
    gap: 2px; /* Reduced gap from 6px to 2px */
    width: 100%;
}

.zodiac-img-wrapper {
    width: 100%;
    padding-bottom: 100%;
    position: relative;
    border-radius: 16px;
    background-color: transparent; /* Changed to transparent */
    border: 2px solid transparent;
    transition: all 0.2s ease;
    box-shadow: none; /* Removed shadow */
}

/* Inner centering for Aspect Ratio Hack */
.zodiac-img-wrapper .inner {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.zodiac-img {
    width: 95%; /* UPSCALED from 60% to 95% (User requested 50%+ larger) */
    height: 95%;
    object-fit: contain;
}

.zodiac-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--theme-text-color); /* Dynamic Contrast */
    white-space: nowrap;
    margin-top: 0; /* Removed margin */
    opacity: 0.95;
    line-height: 1.2;
}

/* Active State */
.zodiac-item.active .zodiac-img-wrapper {
    transform: translateY(-2px);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.4); /* White ring */
}
.zodiac-item.active .zodiac-name {
    color: var(--theme-text-color); /* Dynamic Contrast */
    font-weight: 800;
    opacity: 1;
}

/* Control Bar Section */
.control-bar-section {
    background-color: var(--white);
    padding: 0 10px 20px 10px; /* Reduced side padding (20->10) */
    position: relative;
    border-bottom: 1px solid var(--toss-grey-100);
}

.control-bar-container {
    display: flex;
    justify-content: space-between;
    align-items: flex-start; 
    gap: 8px; /* Reduced gap (12->8) */
}

.control-col {
    flex: 0.8; 
    display: flex;
    justify-content: center;
    padding-top: 6px; /* Reduced top padding (12->6) for vertical Text Center alignment */
}
.control-col.center-col {
    flex: 1.4; /* Wider center */
    padding-top: 0; /* Button sticks to top */
}

/* Center Column usually needs less flexibility if it's a fixed button, 
   or equal flexibility if we want 3 equal cols. User implied equal cols layout usually. 
   Let's try flex: 1 for sides and auto for center? Or all 1?
   Let's stick to flex: 1 for all for now, or make center wider?
   User said "Left, Center, Right 3 columns".
*/

/* Input Styles (Left/Right) */
.input-style {
    width: 100%;
    height: 48px;
    background-color: var(--white);
    border: 1px solid var(--toss-grey-300);
    border-radius: 12px;
    color: var(--toss-grey-900);
    padding: 0 12px;
    font-size: 15px; /* Matched to Button Font Size */
    font-weight: 600; /* Slightly bolder */
    -webkit-appearance: none;
    appearance: none;
    /* Custom Arrow */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b95a1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 16px;
}



/* User Request: Reverted asymmetric rounding, let inputs be standard. 
   The curved connection is handled by the Button's wings now. */
.control-col:first-child .input-style {
    border-radius: 12px;
}
.control-col:last-child .input-style {
    border-radius: 12px;
}

/* Center Button Style */
/* "Text: Find by Zodiac, BG: #00b0ff, Tab Shape (Rounded Bottom)" */
.zodiac-find-btn {
    width: 100%;
    height: 60px; /* Increased height to align with bottom of lower inputs (12px top padding + 48px input = 60px) */
    background-color: var(--theme-color); /* UPDATED */
    color: var(--theme-text-color); /* Dynamic */
    font-size: 15px; /* Slightly larger text for bigger button */
    font-weight: 700;
    border: none;
    border-radius: 0 0 24px 24px; /* Top Square, Bottom Rounded */
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2); /* UPDATED: Generic shadow opacity, color logic is hard in pure css var unless using calc. keeping it simple black alpha */
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-top: -1px; /* Slight pull to cover any sub-pixel white gap */
    z-index: 10;
    overflow: visible; /* CRITICAL: Allow wings to show outside */
}

/* Liquid Connection Wings (Inverted Radius) */
.zodiac-find-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -20px; /* Width of the curve */
    width: 20px;
    height: 20px;
    background: transparent;
    border-top-right-radius: 20px; /* Curve away from button */
    box-shadow: 5px -5px 0 0 var(--theme-color); /* UPDATED */
    z-index: 1;
}

.zodiac-find-btn::after {
    content: '';
    position: absolute;
    top: 0;
    right: -20px;
    width: 20px;
    height: 20px;
    background: transparent;
    border-top-left-radius: 20px;
    box-shadow: -5px -5px 0 0 var(--theme-color); /* UPDATED */
    z-index: 1;
}

/* Adjust Inputs to sit lower */
/* Handled by .control-col padding-top above */


/* 2. Controls Tab - Custom #00afff Design */
.controls-card {
    background: transparent;
    padding: 0; 
}

.controls-wrapper {
    display: flex;
    align-items: stretch;
    justify-content: space-between;
    background: white; /* Changed to White to fill corner notches */
    border: none;
    border-radius: 12px; /* Outer rounding */
    height: 54px;
    gap: 0;
    overflow: hidden; /* Clip everything */
    box-shadow: 0 4px 12px rgba(0,0,0,0.08); /* Stronger shadow for "Filled" look */
}

.control-item {
    flex: 1 1 0px; /* FORCE EQUAL WIDTH */
    width: 0; /* Min width hack for flex */
    position: relative;
    background-color: var(--theme-color); /* UPDATED from #00afff */
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s;
    /* Reset borders */
    border-radius: 0; 
}

/* 1st Tab (Left) */
.control-item:first-child {
    border-top-right-radius: 20px; 
}

/* 3rd Tab (Right) */
.control-item:last-child {
    border-top-left-radius: 20px;
}

/* Center Tab */
.control-divider {
    flex: 1 1 0px; /* FORCE EQUAL WIDTH */
    width: 0; /* Min width hack for flex */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0; /* Remove padding to fit text in 33% */
    background-color: var(--white); 
    position: relative;
}

.divider-text {
    font-size: 13px; /* Slightly smaller to ensure "띠로 나이 찾기" fits in 33% on mobile */
    font-weight: 800; /* Bolder */
    color: var(--toss-grey-900); /* Darker black for contrast */
    letter-spacing: -0.5px;
    white-space: nowrap;
}

/* Select Styles for Blue Background */
.control-item .toss-select {
    color: white;
    font-weight: 700;
    /* Remove default arrow to perfect centering? 
       Or keep white arrow? User said "Balanced". 
       Usually centering is key. */
    text-align: center;
    text-align-last: center; /* Force center even in some browsers */
    padding: 0 10px; /* Reduced padding to help center */
    /* White Arrow - Keep it subtle */
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-position: right 10px center;
    background-size: 14px;
}

.control-item .toss-select option {
    color: var(--toss-grey-900); /* Normal text in dropdown */
}


/* 3. Results - List View */
.result-area {
    display: flex;
    flex-direction: column;
    flex: 1;
    gap: 12px;
    min-height: 0;
}

.result-card {
    flex: 1;
    border: 1px solid var(--toss-grey-200);
    border-radius: 12px;
    overflow: hidden;
    background: var(--white);
    display: flex;
    flex-direction: column;
}

.table-header {
    display: flex;
    background-color: var(--toss-grey-50);
    padding: 10px 0;
    border-bottom: 1px solid var(--toss-grey-200);
}

.th-item {
    flex: 1;
    text-align: center;
    font-size: 13px;
    color: var(--toss-grey-500);
    font-weight: 600;
}

.table-body {
    flex: 1;
    overflow-y: auto;
}

.result-row {
    display: flex;
    padding: 14px 0;
    border-bottom: 1px solid var(--toss-grey-100);
    align-items: center;
}

.td-item {
    flex: 1;
    text-align: center;
    font-size: 15px;
    color: var(--toss-grey-700);
}
.highlight-blue {
    color: var(--toss-blue);
    font-weight: 700;
}
.sub-text {
    font-size: 11px;
    color: var(--toss-grey-400);
    display: block;
    margin-top: 2px;
}
.zodiac-tag {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    background-color: var(--toss-grey-100);
    font-size: 13px;
    z-index: 50;
    box-shadow: 0 -4px 12px rgba(0,0,0,0.05);
}

/* SPLIT LAYOUT (70% Table | 30% Actions) */
.content-split-layout {
    display: flex;
    flex: 1; /* Fill remaining height */
    gap: 12px;
    padding: 0 20px 40px 20px; /* Solid bottom gap */
    /* overflow: hidden;  <-- REMOVED to allow child (result-card) to grow beyond parent height and trigger body scroll */
}

/* LEFT COL (70%) */
.result-left-col {
    flex: 0.7;
    display: flex;
    flex-direction: column;
    min-width: 0; /* Flexbox text truncation fix */
    /* overflow: hidden; <-- REMOVED to prevent clipping */
}

/* Reuse Result Card Styles */
.result-card {
    flex: none; /* FIXED: Do not flex-grow. Stop expanding to content height. */
    height: 560px; /* FIXED: Exact height for 10 items. */
    display: flex; /* Flex layout for Header/Body */
    flex-direction: column;
    /* existing styles apply... */
}

.table-header {
    flex: 0 0 auto; /* Fixed header */
}

.table-body {
    flex: 1; /* Take remaining height */
    overflow-y: auto; /* Scrollable */
    padding-bottom: 20px; /* Internal cushion for scrolling */
    -webkit-overflow-scrolling: touch; /* NEW: Smooth scrolling for iOS */
    /* min-height: 500px; <-- REMOVED: Parent has fixed height now */
    /* Custom Scrollbar for prettiness if needed */
}
.actions-right-col {
    flex: 0.3;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.action-card-item {
    flex: 0 0 auto; /* Stop stretching! Use fixed height */
    height: 80px;   /* Standard compact height */
    background-color: var(--white);
    border: 1px solid var(--toss-grey-200);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.1s, background-color 0.2s;
    box-shadow: var(--shadow-card);
}

.action-card-item:active {
    transform: scale(0.96);
    background-color: var(--toss-grey-100);
}

.action-icon-wrapper {
    margin-bottom: 4px; /* Reduced margin (8->4) */
}

.action-icon-img {
    width: 32px; /* Reduced size (40->32) for compact look */
    height: 32px;
    object-fit: contain;
}

.action-text {
    font-size: 13px; /* Slightly smaller text */
    font-weight: 700;
    color: var(--toss-grey-700);
}

/* Reuse Result Card Styles */


/* Adjust table header/body to match new structure if needed */
/* Existing .table-header, .table-body work fine */

/* Empty State */
.empty-state {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100%;
    color: var(--toss-grey-400);
    font-size: 14px;
}

/* Side Menu */
/* Side Menu - Toss Style */
.side-menu-overlay {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4); /* Darker backdrop */
    z-index: 99;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
    backdrop-filter: blur(2px);
}
.side-menu-overlay.active { opacity: 1; pointer-events: auto; }

.side-menu {
    position: absolute;
    top: 0; right: 0; bottom: 0;
    width: 80%; /* Responsive width */
    max-width: 320px; /* Max width */
    background: var(--white);
    z-index: 100;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1); /* iOS slide ease */
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
    box-shadow: -4px 0 24px rgba(0,0,0,0.1);
    display: flex;
    flex-direction: column;
}
.side-menu.active { transform: translateX(0); }

.menu-header {
    padding: 20px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    /* Removed border for cleaner look */
}

/* Sidebar Login Button */
.header-login-btn {
    text-decoration: none;
    font-size: 16px;
    font-weight: 600;
    color: var(--toss-grey-600); /* Subtler grey */
    background-color: var(--toss-grey-100);
    padding: 8px 16px;
    border-radius: 8px;
    transition: background-color 0.2s;
}
.header-login-btn:active { background-color: var(--toss-grey-200); }

.close-btn {
    background: none; border: none; font-size: 24px; cursor: pointer; color: var(--toss-grey-700);
}

/* Menu Profile Section */
.menu-profile {
    padding: 10px 24px 30px; /* Spacious */
    list-style: none; /* In case it's li */
}
.profile-info {
    font-size: 24px;
    font-weight: 700;
    color: var(--toss-grey-900);
    line-height: 1.4;
}
.profile-info strong {
    color: var(--toss-blue);
}

/* Side Menu Items */
.menu-list {
    list-style: none;
    padding: 0;
    margin: 0;
    flex: 1;
    overflow-y: auto; /* Scrollable content */
}

.menu-item {
    display: block;
    padding: 16px 24px;
    color: var(--toss-grey-800);
    text-decoration: none;
    font-size: 17px;
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.menu-item:active { background-color: var(--toss-grey-50); }

/* Toggle Sections */
.menu-item-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    font-size: 17px;
    color: var(--toss-grey-800);
    font-weight: 500;
}

.arrow {
    font-size: 18px;
    color: var(--toss-grey-300);
    font-weight: 400;
}

/* Generic Modal (App Info) */
.modal-overlay {
    position: fixed;
    top: 0; 
    left: 0; 
    width: 100%; 
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(2px);
}

.modal-content.ios-style {
    background: var(--white);
    padding: 24px;
    border-radius: 20px;
    width: 85%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 4px 24px rgba(0,0,0,0.15);
}



.modal-cta-btn {
    display: block;
    width: 100%;
    background-color: var(--toss-blue);
    color: white;
    text-decoration: none;
    padding: 14px 0;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 8px; /* Space between CTA and Close */
    box-shadow: 0 4px 12px rgba(0, 176, 255, 0.2);
    text-align: center;
    transition: background-color 0.2s, transform 0.1s;
}
.modal-close-btn {
    background-color: var(--toss-grey-100);
    color: var(--toss-grey-700);
    border: none;
    padding: 14px 0;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    margin-top: 0;
}
.modal-cta-btn:active { 
    background-color: #009ce1; 
    transform: scale(0.98);
}

.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 28px;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
}
.slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 4px;
    bottom: 4px;
    background-color: var(--white);
    transition: .4s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}
input:checked + .slider {
    background-color: var(--theme-color); /* UPDATED */
}
input:checked + .slider:before {
    transform: translateX(22px);
}
.slider.round {
    border-radius: 34px;
}
.slider.round:before {
    border-radius: 50%;
}

.menu-item {
    display: block; padding: 14px 20px; color: var(--toss-grey-700); text-decoration: none; font-size: 16px; }

/* Visitor Stats Footer */
/* Visitor Stats Footer - Premium Design */
/* Visitor Stats Footer - Compact & Combined */
/* Visitor Stats Footer - Compact & Combined (Responsive) */
.stats-footer-container {
    margin: 10px 10px 5px; /* Compact margin (Top 10px, Side 10px) */
    padding: 12px; /* Reduced padding for single row */
    background-color: var(--white);
    border-radius: 20px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05); /* Softer shadow */
}

/* Header Removed */
.stats-header { display: none; }

.stats-grid {
    display: grid;
    /* Mobile First: 6 column grid for perfect 3/2 split */
    grid-template-columns: repeat(6, 1fr); 
    gap: 8px 4px; /* Row gap 8px, Col gap 4px */
    background: transparent;
    padding: 0;
    text-align: center;
}

/* Desktop: 5 Flat Columns */
@media (min-width: 640px) {
    .stats-footer-container {
        max-width: 600px;
        margin: 20px auto;
    }
    .stats-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 4px;
    }
    /* Reset spans for desktop */
    .stats-item { grid-column: auto !important; }
}

.stats-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 12px 4px;
    background-color: var(--toss-grey-50);
    border-radius: 16px;
    min-width: 0;
}

/* Mobile Layout Logic (3 Top, 2 Bottom) */
/* Items 1,2,3 take 2 columns each (3 x 2 = 6) */
.stats-item:nth-child(1), 
.stats-item:nth-child(2), 
.stats-item:nth-child(3) {
    grid-column: span 2;
}

/* Items 4,5 take 3 columns each (2 x 3 = 6) -> Wider for Cumulative numbers */
.stats-item:nth-child(4), 
.stats-item:nth-child(5) {
    grid-column: span 3;
}

/* Copyright Footer */
.app-copyright {
    text-align: center;
    color: var(--toss-grey-500);
    font-size: 13px;
    font-weight: 500;
    margin-top: 20px;
    padding-bottom: 40px; /* Ensure visibility above safe area / fixed ads */
}

.stats-item .label {
    font-size: 12px;
    color: var(--toss-grey-500);
    font-weight: 600;
}

/* Header Logo Text */
.header-logo-text {
    font-size: 17px; /* Reduced from 20px to match hamburger */
    font-weight: 800;
    color: var(--theme-text-color); /* Dynamic */
    letter-spacing: -0.5px;
    line-height: 1; /* Tighten line height */
}

.stats-item .value {
    font-size: 16px;
    font-weight: 700;
    color: var(--toss-grey-900);
    letter-spacing: -0.5px;
}

/* Mobile: Compact Grid if needed, but 4 cols usually fits numbers */
@media (max-width: 360px) {
    .zodiac-grid { gap: 6px 2px; }
    .header-title { font-size: 16px; }
    .toss-select { font-size: 13px; }
    .stats-grid { gap: 4px; padding: 12px; }
    .stats-item .value { font-size: 13px; }
}

/* IOS Install Guide */
.ios-guide-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.6);
    z-index: 9999;
    align-items: flex-end; /* Bottom align for iOS sheet feel */
    justify-content: center;
    padding-bottom: 20px;
}

.ios-guide-card {
    background: white;
    width: 90%;
    max-width: 400px;
    padding: 24px;
    border-radius: 20px;
    text-align: center;
    position: relative;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
    from { transform: translateY(100%); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.ios-guide-card h3 {
    font-size: 18px;
    font-weight: 800;
    margin-bottom: 12px;
}

.ios-guide-card p {
    font-size: 15px;
    color: var(--toss-grey-700);
    line-height: 1.5;
    margin-bottom: 20px;
}

.ios-guide-card button {
    width: 100%;
    padding: 14px;
    background: var(--toss-blue);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
}

/* Arrow pointing to Safari toolbar if possible, generic arrow for now */
.ios-arrow {
    position: absolute;
    bottom: -10px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 20px;
    height: 20px;
    background: white;
    display: none; /* Hard to target exact toolbar pixels universally */
}

/* Hide Install Button if already PWA */
@media (display-mode: standalone) {
    #installBtn {
        display: none !important;
    }
}
/* --- AdSense Fixed Footer (Restored) --- */
.fixed-ad-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    background-color: var(--white);
    box-shadow: 0 -2px 10px rgba(0,0,0,0.05);
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 10px 0;
    min-height: 70px; 
}

.app-container {
    padding-bottom: 70px; 
}

/* =========================================
   DARK MODE OVERRIDES
   ========================================= */
[data-theme='dark'] {
    /* 1. Backgrounds & Structure */
    --white: #202632; /* Card Background -> Dark Grey */
    --toss-grey-50: #10141b; /* Table Header Background -> Darker */
    --toss-grey-100: #10141b; /* App Content Background -> Almost Black */
    --toss-grey-200: #2b303b; /* Borders -> Slightly Lighter Grey */
    
    /* 2. Text Colors */
    --toss-grey-900: #e8f3ff; /* Main Text -> Off-white */
    --toss-grey-800: #d1d6db;
    --toss-grey-700: #b0b8c1;
    --toss-grey-600: #8b95a1;
    --toss-grey-500: #6b7684;
    
    /* 3. Inputs & Forms */
    --toss-grey-300: #4e5968; /* Input Borders */
}

/* Specific Dark Mode Exceptions/Fixes */

/* Slider Arrows in Dark Mode */
[data-theme='dark'] .slider-btn {
    background: rgba(255,255,255,0.1);
    color: white;
}

/* Toggle Switch Styles (Global, but relevant for DM toggle) */
#darkModeCheckbox:checked + .slider {
    background-color: var(--toss-blue);
}
#darkModeCheckbox:focus + .slider {
    box-shadow: 0 0 1px var(--toss-blue);
}
#darkModeCheckbox:checked + .slider .slider-thumb {
    transform: translateX(20px);
}

/* Menu Styles in Dark Mode */
[data-theme='dark'] .side-menu {
    background-color: #202632;
}
[data-theme='dark'] .menu-item,
[data-theme='dark'] .menu-item-toggle .menu-text {
    color: #e8f3ff;
}
[data-theme='dark'] #darkModeToggleItem,
[data-theme='dark'] #colorPickerToggle,
[data-theme='dark'] #colorPickerContainer {
    border-bottom: 1px solid #2b303b;
    color: #e8f3ff;
}
[data-theme='dark'] #colorPickerContainer {
    background-color: #171c26;
}
