:root {
    --bg-color: #0b0f19;
    --card-bg: #111827;
    --text-main: #f3f4f6;
    --text-secondary: #9ca3af;
    --accent-color: #3b82f6;
    --accent-hover: #2563eb;
    --border-color: #374151;
    --input-bg: #1f2937;
    --radius-md: 8px;
    --radius-lg: 12px;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 2rem;
}

.app-container {
    width: 100%;
    max-width: 1000px;
}

header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

/* Navigation Tabs */
.nav-tabs {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 1rem;
}

.nav-tab {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    padding: 0.5rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: color 0.2s;
}

.nav-tab.active {
    color: var(--text-main);
}

.nav-tab i {
    font-size: 1.2rem;
}

/* Sections */
section {
    display: none;
    animation: fadeIn 0.3s ease;
}

section.active {
    display: block;
}

/* Dropzones */
.dropzone-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.dropzone-wrapper label {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.dropzone {
    background-color: rgba(255, 255, 255, 0.03);
    border: 2px dashed var(--border-color);
    border-radius: var(--radius-lg);
    height: 250px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
    overflow: hidden;
}

.dropzone:hover {
    border-color: var(--accent-color);
    background-color: rgba(59, 130, 246, 0.05);
}

.dropzone-content {
    text-align: center;
    color: var(--text-secondary);
    pointer-events: none;
}

.dropzone-content i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    opacity: 0.7;
}

.dropzone-content p {
    font-size: 0.95rem;
}

.small-text {
    font-size: 0.8rem;
    opacity: 0.7;
}

.preview-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    position: absolute;
    top: 0;
    left: 0;
    background: #000;
}

.remove-btn {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.6);
    border: none;
    color: white;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.remove-btn:hover {
    background: rgba(0, 0, 0, 0.8);
}

.text-input-wrapper {
    margin-top: 0.75rem;
}

.dark-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s;
}

.dark-input:focus {
    border-color: var(--accent-color);
}

/* Controls */
.control-panel {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 2rem;
}

.slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.slider-header label {
    font-weight: 600;
}

.badge {
    background: #1f2937;
    padding: 0.2rem 0.6rem;
    border-radius: 4px;
    font-family: monospace;
    border: 1px solid var(--border-color);
}

.styled-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    background: #374151;
    border-radius: 3px;
    outline: none;
    margin-bottom: 1.5rem;
}

.styled-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--bg-color);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

.info-box {
    display: flex;
    gap: 1rem;
    background: rgba(59, 130, 246, 0.05);
    border: 1px solid rgba(59, 130, 246, 0.1);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.info-box i {
    color: var(--accent-color);
    margin-top: 0.2rem;
}

.info-box strong {
    color: var(--text-main);
}

/* Buttons */
.action-btn {
    width: 100%;
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-decoration: none;
}

.action-btn.primary {
    background-color: var(--accent-color);
    color: white;
}

.action-btn.primary:hover {
    background-color: var(--accent-hover);
}

.action-btn.secondary {
    background-color: transparent;
    border: 1px solid var(--border-color);
    color: var(--text-main);
    margin-top: 1rem;
}

.action-btn.secondary:hover {
    background-color: rgba(255, 255, 255, 0.05);
}

/* Results */
.result-container {
    margin-top: 2rem;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    text-align: center;
    animation: fadeIn 0.5s ease;
}

.result-container h3 {
    margin-bottom: 1.5rem;
    font-size: 1.2rem;
}

.result-image-wrapper {
    background: #000;
    border-radius: var(--radius-md);
    overflow: hidden;
    margin-bottom: 1rem;
    max-height: 500px;
    display: flex;
    justify-content: center;
}

.result-image-wrapper img {
    max-width: 100%;
    max-height: 500px;
    object-fit: contain;
}

.qr-wrapper img {
    max-width: 200px;
    image-rendering: pixelated;
}

/* Loading */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(11, 15, 25, 0.8);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-top-color: var(--accent-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 1rem;
}

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

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 768px) {
    .dropzone-container {
        grid-template-columns: 1fr;
    }
}
.secret-text-display {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 16px;
    word-break: break-all;
}

.secret-text-display strong {
    color: var(--accent-color, #3b82f6);
    font-family: monospace;
    font-size: 1.3rem;
}

/* ---------- 帳號系統 ---------- */
.auth-overlay {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-color, #0f172a);
    z-index: 100;
    padding: 20px;
}

.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 16px;
    padding: 36px 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.auth-card h2 {
    margin: 0;
    text-align: center;
}

.auth-subtitle {
    text-align: center;
    color: var(--text-secondary, #94a3b8);
    font-size: 0.9rem;
    margin: 0 0 8px;
}

.auth-error {
    color: #f87171;
    font-size: 0.88rem;
    margin: 0;
    text-align: center;
}

.header-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.user-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--text-secondary, #94a3b8);
}

.link-btn {
    background: none;
    border: none;
    color: var(--accent-color, #3b82f6);
    cursor: pointer;
    font-size: 0.88rem;
    padding: 4px 8px;
    text-decoration: none;
}

.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: #f87171; }

.save-note { text-align: center; font-size: 0.9rem; margin: 0 0 12px; }
.save-note.ok { color: #4ade80; }
.save-note.warn { color: #fbbf24; }

/* ---------- 我的圖片 ---------- */
.history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
}

.history-card {
    background: var(--card-bg, #1e293b);
    border: 1px solid var(--border-color, #334155);
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.history-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    display: block;
}

.history-info { padding: 10px 14px 0; }

.history-secret {
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    font-weight: 700;
    color: var(--accent-color, #3b82f6);
}

.history-date {
    font-size: 0.78rem;
    color: var(--text-secondary, #94a3b8);
}

.history-actions {
    display: flex;
    justify-content: flex-end;
    gap: 4px;
    padding: 6px 8px 8px;
}

/* hidden 屬性必須永遠生效，否則 display:flex 之類的規則會蓋過它，
   造成遮罩永遠擋在頁面上（登入卡在「處理中」就是這個原因） */
[hidden] {
    display: none !important;
}
