/* ===================================
   WebToolBox — Design System
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

/* --- CSS Variables --- */
:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-card: rgba(17, 24, 39, 0.8);
    --bg-glass: rgba(255, 255, 255, 0.04);
    --bg-glass-hover: rgba(255, 255, 255, 0.08);
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-medium: rgba(255, 255, 255, 0.1);
    --border-accent: rgba(99, 102, 241, 0.3);

    --text-primary: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --text-accent: #818cf8;

    --accent-indigo: #6366f1;
    --accent-purple: #a855f7;
    --accent-blue: #3b82f6;
    --accent-cyan: #06b6d4;
    --accent-emerald: #10b981;
    --accent-amber: #f59e0b;
    --accent-rose: #f43f5e;

    --gradient-primary: linear-gradient(135deg, #6366f1 0%, #a855f7 50%, #ec4899 100%);
    --gradient-card: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(168, 85, 247, 0.05) 100%);
    --gradient-success: linear-gradient(135deg, #10b981, #34d399);
    --gradient-warning: linear-gradient(135deg, #f59e0b, #fbbf24);
    --gradient-error: linear-gradient(135deg, #f43f5e, #fb7185);
    --gradient-bg: radial-gradient(ellipse at 20% 50%, rgba(99, 102, 241, 0.08) 0%, transparent 50%),
                   radial-gradient(ellipse at 80% 20%, rgba(168, 85, 247, 0.06) 0%, transparent 50%),
                   radial-gradient(ellipse at 50% 80%, rgba(6, 182, 212, 0.04) 0%, transparent 50%);

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: 0 0 30px rgba(99, 102, 241, 0.15);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- Reset & Base --- */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: var(--gradient-bg);
    pointer-events: none;
    z-index: 0;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: -0.02em;
}

code, .mono {
    font-family: 'JetBrains Mono', monospace;
}

/* --- Layout --- */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

.container-narrow {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 24px;
    position: relative;
    z-index: 1;
}

/* --- Header --- */
.site-header {
    padding: 20px 0;
    border-bottom: 1px solid var(--border-subtle);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 26, 0.85);
}

.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--text-primary);
}

.logo-icon {
    width: 42px;
    height: 42px;
    background: var(--gradient-primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    box-shadow: var(--shadow-glow);
}

.logo-text {
    font-size: 22px;
    font-weight: 800;
    background: var(--gradient-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.logo-sub {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 400;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* --- Hero Section --- */
.hero {
    text-align: center;
    padding: 72px 0 32px;
}

.hero h1 {
    font-size: clamp(2rem, 5vw, 3.2rem);
    font-weight: 800;
    margin-bottom: 16px;
    background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.hero p {
    font-size: 1.05rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto 40px;
}

/* --- Search Box --- */
.search-container {
    max-width: 680px;
    margin: 0 auto;
}

.search-box {
    display: flex;
    align-items: center;
    background: var(--bg-glass);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl);
    padding: 6px 6px 6px 24px;
    transition: all var(--transition-normal);
    backdrop-filter: blur(10px);
}

.search-box:focus-within {
    border-color: var(--accent-indigo);
    box-shadow: var(--shadow-glow), 0 0 0 4px rgba(99, 102, 241, 0.1);
}

.search-box input {
    flex: 1;
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 16px;
    font-family: 'Inter', sans-serif;
    padding: 12px 0;
    min-width: 0;
}

.search-box input::placeholder {
    color: var(--text-muted);
}

.btn-capture {
    background: var(--gradient-primary);
    border: none;
    color: white;
    padding: 12px 28px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition-normal);
    white-space: nowrap;
    position: relative;
    overflow: hidden;
    flex-shrink: 0;
}

.btn-capture::before {
    content: '';
    position: absolute;
    top: 0; left: -100%; width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: all 0.5s;
}

.btn-capture:hover::before {
    left: 100%;
}

.btn-capture:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.4);
}

.btn-capture:active {
    transform: translateY(0);
}

.btn-capture:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

/* --- Options Panel --- */
.options-panel {
    max-width: 680px;
    margin: 20px auto 0;
}

.options-toggle {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 13px;
    cursor: pointer;
    font-family: 'Inter', sans-serif;
    transition: color var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 auto;
    padding: 8px 16px;
    border-radius: var(--radius-full);
}

.options-toggle:hover {
    color: var(--text-primary);
    background: var(--bg-glass);
}

.options-toggle .arrow {
    transition: transform var(--transition-normal);
    font-size: 10px;
}

.options-toggle.active .arrow {
    transform: rotate(180deg);
}

.options-content {
    display: none;
    margin-top: 16px;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: 24px;
    backdrop-filter: blur(10px);
    animation: slideDown 0.3s ease;
}

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

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

.options-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.option-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.option-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.option-select, .option-input {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    transition: border-color var(--transition-fast);
    outline: none;
    width: 100%;
}

.option-select:focus, .option-input:focus {
    border-color: var(--accent-indigo);
}

.option-select option {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

/* Aspect Ratio Selector */
.aspect-ratio-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.aspect-btn {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 8px 14px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 6px;
}

.aspect-btn:hover {
    border-color: var(--accent-indigo);
    color: var(--text-primary);
    background: rgba(99, 102, 241, 0.1);
}

.aspect-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-indigo);
    color: var(--text-primary);
    box-shadow: 0 0 12px rgba(99, 102, 241, 0.2);
}

.aspect-icon {
    display: inline-block;
    border: 1.5px solid currentColor;
    border-radius: 2px;
}

/* Border Options */
.border-options {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.border-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-secondary);
}

.border-toggle input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 40px;
    height: 22px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 11px;
    position: relative;
    cursor: pointer;
    transition: background var(--transition-fast);
}

.border-toggle input[type="checkbox"]::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: white;
    transition: transform var(--transition-fast);
}

.border-toggle input[type="checkbox"]:checked {
    background: var(--accent-indigo);
}

.border-toggle input[type="checkbox"]:checked::after {
    transform: translateX(18px);
}

.border-settings {
    display: none;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.border-settings.active {
    display: flex;
}

.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 4px 10px;
}

.color-input-wrap input[type="color"] {
    width: 28px;
    height: 28px;
    border: none;
    background: none;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.color-input-wrap input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 4px;
}

.color-hex {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-secondary);
    background: none;
    border: none;
    width: 70px;
    outline: none;
}

.range-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.range-wrap input[type="range"] {
    width: 100px;
    accent-color: var(--accent-indigo);
    height: 4px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
    outline: none;
    -webkit-appearance: none;
}

.range-wrap input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-indigo);
    cursor: pointer;
    box-shadow: 0 0 8px rgba(99, 102, 241, 0.4);
}

.range-value {
    font-size: 13px;
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    min-width: 32px;
    text-align: right;
}

/* --- Result Section --- */
.result-section {
    max-width: 900px;
    margin: 40px auto;
    padding: 0 24px;
    display: none;
    position: relative;
    z-index: 1;
}

.result-section.active {
    display: block;
    animation: fadeIn 0.5s ease;
}

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

.result-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(10px);
    position: relative;
}

.result-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--gradient-primary);
}

.result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-subtle);
    flex-wrap: wrap;
    gap: 12px;
}

.result-meta {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.result-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.result-url {
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    color: var(--text-muted);
    word-break: break-all;
}

.result-info {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: var(--text-muted);
}

.result-info-item {
    display: flex;
    align-items: center;
    gap: 4px;
    background: var(--bg-glass);
    padding: 4px 10px;
    border-radius: var(--radius-full);
    border: 1px solid var(--border-subtle);
}

.result-image-wrap {
    padding: 24px;
    display: flex;
    justify-content: center;
    background: repeating-conic-gradient(rgba(255,255,255,0.03) 0% 25%, transparent 0% 50%) 50% / 20px 20px;
}

.result-image {
    max-width: 100%;
    max-height: 70vh;
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-normal);
    cursor: zoom-in;
}

.result-image:hover {
    transform: scale(1.01);
}

.result-actions {
    display: flex;
    gap: 8px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-subtle);
    justify-content: flex-end;
    flex-wrap: wrap;
}

.btn-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    text-decoration: none;
}

.btn-action:hover {
    background: var(--bg-glass-hover);
    color: var(--text-primary);
    border-color: var(--border-medium);
}

.btn-action.primary {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.3);
    color: var(--text-accent);
}

.btn-action.primary:hover {
    background: rgba(99, 102, 241, 0.25);
}

.btn-action.danger {
    background: rgba(244, 63, 94, 0.1);
    border-color: rgba(244, 63, 94, 0.2);
    color: #fb7185;
}

.btn-action.danger:hover {
    background: rgba(244, 63, 94, 0.2);
}

/* --- History Section --- */
.history-section {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 80px;
    position: relative;
    z-index: 1;
}

.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.section-title {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

.section-count {
    background: var(--bg-glass);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    font-size: 12px;
    padding: 2px 10px;
    border-radius: var(--radius-full);
    font-weight: 500;
}

.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 20px;
}

.history-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: all var(--transition-normal);
    cursor: pointer;
}

.history-card:hover {
    border-color: var(--border-medium);
    transform: translateY(-4px);
    box-shadow: var(--shadow-md);
}

.history-thumb {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
    background: rgba(0, 0, 0, 0.3);
    display: block;
}

.history-info {
    padding: 14px 16px;
}

.history-domain {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-title-text {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 8px;
}

.history-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    color: var(--text-muted);
}

.history-badge {
    padding: 2px 8px;
    border-radius: var(--radius-full);
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    background: rgba(99, 102, 241, 0.15);
    color: var(--text-accent);
    border: 1px solid rgba(99, 102, 241, 0.2);
}

.history-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 60px 20px;
    grid-column: 1 / -1;
}

.history-empty .empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

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

/* --- Pagination --- */
.pagination {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-top: 32px;
}

.page-btn {
    padding: 8px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border-subtle);
    background: var(--bg-glass);
    color: var(--text-secondary);
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.page-btn:hover {
    border-color: var(--accent-indigo);
    color: var(--text-primary);
}

.page-btn.active {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--accent-indigo);
    color: var(--text-primary);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* --- Loading Spinner --- */
.spinner-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 14, 26, 0.7);
    backdrop-filter: blur(4px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.spinner-overlay.active {
    display: flex;
}

.spinner-content {
    text-align: center;
}

.spinner-ring {
    width: 56px;
    height: 56px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--accent-indigo);
    border-right-color: var(--accent-purple);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}

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

.spinner-text {
    color: var(--text-secondary);
    font-size: 15px;
    font-weight: 500;
}

.spinner-sub {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 6px;
}

/* --- Lightbox --- */
.lightbox {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.9);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    cursor: zoom-out;
    padding: 24px;
}

.lightbox.active {
    display: flex;
    animation: fadeIn 0.2s ease;
}

.lightbox img {
    max-width: 95%;
    max-height: 95vh;
    border-radius: var(--radius-sm);
    box-shadow: 0 0 60px rgba(0, 0, 0, 0.5);
}

.lightbox-close {
    position: absolute;
    top: 24px;
    right: 24px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(0, 0, 0, 0.5);
    color: white;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition-fast);
}

.lightbox-close:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    min-width: 300px;
    max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: slideIn 0.3s ease;
    backdrop-filter: blur(20px);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.toast.error {
    border-left: 3px solid var(--accent-rose);
}

.toast.success {
    border-left: 3px solid var(--accent-emerald);
}

.toast.info {
    border-left: 3px solid var(--accent-blue);
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(100px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100px); }
}

/* --- Footer --- */
.site-footer {
    padding: 24px 0;
    border-top: 1px solid var(--border-subtle);
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    position: relative;
    z-index: 1;
}

.service-list-container {
    margin-bottom: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border-medium);
}

.service-list-container p {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    font-weight: bold;
}

.service-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.service-list a {
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13px;
    padding: 6px 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 4px;
    transition: all 0.2s;
}

.service-list a:hover {
    background: rgba(255,255,255,0.1);
    color: var(--text-primary);
}

/* === Global Navigation === */
.global-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    align-items: center;
    justify-content: flex-end;
}
.nav-link {
    display: flex; align-items: center; gap: 6px;
    padding: 6px 14px; border-radius: var(--radius-full);
    color: var(--text-muted); text-decoration: none;
    font-size: 13px; font-weight: 500;
    transition: all var(--transition-fast); white-space: nowrap;
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-glass-hover); }
.nav-link.active { color: var(--text-primary); background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.2); }
.nav-icon { font-size: 15px; }
.nav-toggle {
    display: none; background: none; border: none;
    color: var(--text-primary); font-size: 24px; cursor: pointer; padding: 4px 8px;
}

/* === Portal === */
.portal-hero { padding: 80px 0 40px; }
.portal-hero h1 {
    font-size: clamp(2rem,5vw,3.5rem); font-weight: 800;
    background: var(--gradient-primary); -webkit-background-clip: text;
    -webkit-text-fill-color: transparent; background-clip: text;
    margin-bottom: 16px; text-align: center;
}
.hero-sub { text-align: center; color: var(--text-secondary); font-size: 1.1rem; max-width: 600px; margin: 0 auto; line-height: 1.8; }
.portal-tools { padding: 20px 0 60px; position: relative; z-index: 1; }
.tool-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 20px; max-width: 900px; margin: 0 auto; }
.tool-card {
    display: flex; align-items: center; gap: 20px;
    background: var(--bg-card); border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg); padding: 28px 24px;
    text-decoration: none; color: var(--text-primary);
    transition: all var(--transition-normal); position: relative; overflow: hidden;
}
.tool-card::before { content:''; position: absolute; top:0; left:0; width: 3px; height: 100%; background: var(--tool-color); opacity: 0.6; transition: width var(--transition-normal); }
.tool-card:hover { border-color: var(--border-medium); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.tool-card:hover::before { width: 5px; opacity: 1; }
.tool-card-icon { font-size: 40px; width: 64px; height: 64px; display: flex; align-items: center; justify-content: center; background: color-mix(in srgb, var(--tool-color) 12%, transparent); border-radius: var(--radius-md); flex-shrink: 0; }
.tool-card-body { flex: 1; }
.tool-card-title { font-size: 18px; font-weight: 700; margin-bottom: 4px; }
.tool-card-desc { font-size: 14px; color: var(--text-secondary); }
.tool-card-arrow { font-size: 20px; color: var(--text-muted); transition: transform var(--transition-fast); flex-shrink: 0; }
.tool-card:hover .tool-card-arrow { transform: translateX(4px); color: var(--tool-color); }
.portal-stats { padding: 40px 0 80px; position: relative; z-index: 1; }
.stats-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; max-width: 900px; margin: 0 auto; }
.stat-item { text-align: center; padding: 24px 16px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); }
.stat-value { font-size: 28px; font-weight: 800; background: var(--gradient-primary); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; font-family: 'JetBrains Mono', monospace; }
.stat-label { font-size: 12px; color: var(--text-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.05em; }

/* === Tool Page Header === */
.tool-page-header { text-align: center; padding: 48px 0 24px; }
.tool-page-header h1 { font-size: clamp(1.6rem,4vw,2.4rem); font-weight: 800; margin-bottom: 8px; background: linear-gradient(135deg,#f1f5f9,#94a3b8); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.tool-page-header p { font-size: 1rem; color: var(--text-secondary); max-width: 600px; margin: 0 auto; }

/* === URL Input (shared) === */
.url-input-container { max-width: 680px; margin: 0 auto 24px; padding: 0 24px; }
.url-input-box { display: flex; align-items: center; background: var(--bg-glass); border: 1px solid var(--border-medium); border-radius: var(--radius-xl); padding: 6px 6px 6px 24px; transition: all var(--transition-normal); backdrop-filter: blur(10px); }
.url-input-box:focus-within { border-color: var(--accent-indigo); box-shadow: var(--shadow-glow), 0 0 0 4px rgba(99,102,241,0.1); }
.url-input-box input[type="text"] { flex: 1; background: transparent; border: none; outline: none; color: var(--text-primary); font-size: 16px; font-family: 'Inter', sans-serif; padding: 12px 0; min-width: 0; }
.url-input-box input::placeholder { color: var(--text-muted); }
.url-input-box .btn-submit { background: var(--gradient-primary); border: none; color: white; padding: 12px 28px; border-radius: var(--radius-lg); font-size: 15px; font-weight: 600; font-family: 'Inter', sans-serif; cursor: pointer; transition: all var(--transition-normal); white-space: nowrap; flex-shrink: 0; }
.url-input-box .btn-submit:hover { transform: translateY(-1px); box-shadow: 0 4px 20px rgba(99,102,241,0.4); }
.url-input-box .btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none !important; }

/* === Short URL === */
.short-result { max-width: 680px; margin: 0 auto; padding: 0 24px; display: none; position: relative; z-index: 1; }
.short-result.active { display: block; animation: fadeIn 0.5s ease; }
.short-url-display { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); padding: 32px 24px; text-align: center; }
.short-url-value { font-size: 22px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--accent-indigo); word-break: break-all; margin-bottom: 12px; }
.short-url-original { font-size: 13px; color: var(--text-muted); word-break: break-all; margin-bottom: 20px; }
.btn-copy { background: rgba(99,102,241,0.15); border: 1px solid rgba(99,102,241,0.3); color: var(--text-accent); padding: 10px 24px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600; cursor: pointer; transition: all var(--transition-fast); font-family: 'Inter', sans-serif; }
.btn-copy:hover { background: rgba(99,102,241,0.25); }
.short-history { max-width: 680px; margin: 24px auto 60px; padding: 0 24px; position: relative; z-index: 1; }

/* === OGP Preview === */
.ogp-result { max-width: 800px; margin: 0 auto; padding: 0 24px; display: none; position: relative; z-index: 1; }
.ogp-result.active { display: block; animation: fadeIn 0.5s ease; }
.ogp-previews { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 24px; margin-bottom: 24px; }
.ogp-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.ogp-card-header { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); font-size: 13px; font-weight: 600; color: var(--text-muted); display: flex; align-items: center; gap: 8px; }
.ogp-card-body { padding: 0; }
.ogp-card-body img { width: 100%; aspect-ratio: 1200/630; object-fit: cover; display: block; }
.ogp-card-info { padding: 12px 16px; }
.ogp-card-info .ogp-title { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ogp-card-info .ogp-desc { font-size: 13px; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ogp-card-info .ogp-domain { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.ogp-raw { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 16px; margin-bottom: 40px; }
.ogp-raw table { width: 100%; border-collapse: collapse; font-size: 13px; }
.ogp-raw th { text-align: left; padding: 8px; color: var(--text-accent); font-weight: 600; width: 160px; border-bottom: 1px solid var(--border-subtle); }
.ogp-raw td { padding: 8px; color: var(--text-secondary); word-break: break-all; border-bottom: 1px solid var(--border-subtle); }

/* === Image Compress === */
.upload-zone { max-width: 680px; margin: 0 auto 24px; padding: 48px 24px; border: 2px dashed var(--border-medium); border-radius: var(--radius-lg); text-align: center; cursor: pointer; transition: all var(--transition-normal); background: var(--bg-glass); position: relative; z-index: 1; }
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent-indigo); background: rgba(99,102,241,0.05); }
.upload-zone-icon { font-size: 48px; margin-bottom: 12px; }
.upload-zone-text { color: var(--text-secondary); font-size: 15px; }
.upload-zone-hint { color: var(--text-muted); font-size: 12px; margin-top: 8px; }
.compress-options { max-width: 680px; margin: 0 auto 24px; padding: 20px 24px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); display: none; position: relative; z-index: 1; }
.compress-options.active { display: block; animation: fadeIn 0.3s ease; }
.compress-result { max-width: 680px; margin: 0 auto 60px; padding: 0 24px; display: none; position: relative; z-index: 1; }
.compress-result.active { display: block; animation: fadeIn 0.5s ease; }
.compress-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; }
.compare-card { background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 16px; text-align: center; }
.compare-card img { max-width: 100%; max-height: 200px; border-radius: var(--radius-sm); margin-bottom: 12px; }
.compare-label { font-size: 12px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; margin-bottom: 8px; }
.compare-size { font-size: 20px; font-weight: 700; font-family: 'JetBrains Mono', monospace; }
.savings-badge { display: inline-block; padding: 6px 16px; border-radius: var(--radius-full); background: rgba(16,185,129,0.15); color: #34d399; font-size: 14px; font-weight: 700; margin: 12px 0; }

/* === Responsive === */
@media (max-width: 768px) {
    .hero, .portal-hero { padding: 48px 0 24px; }
    .hero h1, .portal-hero h1 { font-size: 1.8rem; }
    .search-box, .url-input-box { flex-direction: column; border-radius: var(--radius-lg); padding: 8px; }
    .search-box input, .url-input-box input[type="text"] { padding: 12px 16px; width: 100%; }
    .btn-capture, .url-input-box .btn-submit { width: 100%; border-radius: var(--radius-md); }
    .options-grid { grid-template-columns: 1fr; }
    .tool-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2,1fr); }
    .result-header { flex-direction: column; text-align: center; }
    .result-info { justify-content: center; }
    .result-actions { justify-content: center; }
    .history-grid { grid-template-columns: 1fr; }
    .global-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: rgba(10,14,26,0.95); backdrop-filter: blur(20px); flex-direction: column; padding: 16px; border-bottom: 1px solid var(--border-subtle); gap: 4px; }
    .global-nav.open { display: flex; }
    .nav-toggle { display: block; }
    .header-inner { position: relative; }
    .ogp-previews { grid-template-columns: 1fr; }
    .compress-compare { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .border-settings { flex-direction: column; align-items: flex-start; }
    .stats-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

