/* ── Zen Design System ─────────────────────────────────────── */

:root {
    --bg: #F6F4EE;
    --text: #2C2C2C;
    --text-light: #707070;
    --text-ghost: #9A9A96;
    --accent: #B8B0A4;
    --accent-hover: #A09888;
    --surface: #FAF9F5;
    --divider: #EAE7DF;
    --success: #8DB580;
    --danger: #C4938A;

    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;

    --transition-slow: 1.2s ease;
    --transition-med: 0.7s ease;
}

/* ── Reset & Base ─────────────────────────────────────────── */

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

html, body {
    height: 100%;
    font-family: var(--font-ui);
    font-weight: 300;
    color: var(--text);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Layout ───────────────────────────────────────────────── */

.app {
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    padding: 0 24px;
}

.container {
    width: 100%;
    max-width: 480px;
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

/* ── Account Link ─────────────────────────────────────────── */

.account-bar {
    position: fixed;
    top: 16px;
    right: 20px;
    z-index: 100;
}

.account-link {
    font-size: 12px;
    font-weight: 400;
    color: var(--text-ghost);
    text-decoration: none;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: color var(--transition-med);
}

.account-link:hover {
    color: var(--text-light);
}

/* ── Tabs ─────────────────────────────────────────────────── */

.tabs {
    display: flex;
    justify-content: safe center;
    align-items: center;
    gap: 24px;
    padding-top: 48px;
    padding-bottom: 8px;
    position: relative;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

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

.tabs-chevron {
    font-family: var(--font-ui);
    font-size: 18px;
    font-weight: 300;
    color: var(--text-ghost);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 4px;
    transition: color var(--transition-med);
    line-height: 1;
}

.tabs-chevron:hover {
    color: var(--text-light);
}

.tab {
    font-size: 15px;
    font-weight: 400;
    color: var(--text-ghost);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 0;
    position: relative;
    transition: color var(--transition-slow);
    letter-spacing: 0.01em;
}

.tab::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    right: 50%;
    height: 1px;
    background: var(--text);
    transition: left 1s ease, right 1s ease;
}

.tab:hover {
    color: var(--text-light);
}

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

.tab.active::after {
    left: 0;
    right: 0;
}

/* ── Main Item Display ────────────────────────────────────── */

.item-area {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 0;
}

.item-origin {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 400;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
    text-align: center;
}

.item-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 36px;
    line-height: 1.3;
    text-align: center;
    color: var(--text);
    max-width: 400px;
    word-break: break-word;
}

.item-link {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-ghost);
    text-decoration: none;
    margin-top: 12px;
    display: inline-block;
    transition: color 0.2s ease;
}

.item-link:hover {
    color: var(--text-light);
}

.item-enter {
    animation: fadeInUp 1.4s ease forwards;
}

.item-exit {
    animation: fadeOut 0.45s ease forwards;
}

.item-complete {
    animation: strikethroughOut 1.6s ease forwards;
}

.item-throw-left {
    animation: throwLeft 0.6s ease-in forwards;
}

.item-throw-right {
    animation: throwRight 0.6s ease-in forwards;
}

/* ── Empty State ──────────────────────────────────────────── */

.empty-state {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 32px;
    color: var(--text-ghost);
    animation: breathe 4s ease-in-out infinite;
}

/* ── Add Item ─────────────────────────────────────────────── */

.add-area {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 4px 0 8px;
}

.add-toggle {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 400;
    color: var(--text-ghost);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 4px;
    letter-spacing: 0.02em;
    transition: color var(--transition-med);
}

.add-toggle:hover {
    color: var(--text-light);
}

.add-toggle.open {
    color: var(--text-light);
}

.add-form {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.5s ease, opacity 0.4s ease, margin 0.4s ease;
}

.add-form.visible {
    max-width: 360px;
    opacity: 1;
    margin-left: 8px;
}

.add-input {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 300;
    color: var(--text);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--divider);
    outline: none;
    padding: 6px 0;
    width: 260px;
    transition: border-color var(--transition-med);
}

.add-input::placeholder {
    color: var(--text-ghost);
}

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

.add-btn {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 300;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    color: var(--text-ghost);
    transition: color var(--transition-med);
}

.add-btn:hover {
    color: var(--text);
}

/* ── Action Bar ───────────────────────────────────────────── */

.action-bar {
    display: flex;
    justify-content: center;
    gap: 24px;
    padding: 16px 0 48px;
    opacity: 0;
    transition: opacity 1.4s ease;
}

.action-bar.visible {
    opacity: 1;
}

.action-btn {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 400;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 4px;
    letter-spacing: 0.02em;
    transition: color var(--transition-med);
}

.action-btn:hover {
    color: var(--text);
}

.action-btn.complete:hover {
    color: var(--success);
}

.action-btn.remove:hover {
    color: var(--danger);
}

.action-btn.abandon:hover {
    color: var(--danger);
}

.item-lock {
    font-size: 0.45em;
    vertical-align: middle;
    margin-left: 6px;
}

/* ── Account Panel ────────────────────────────────────────── */

.overlay {
    position: fixed;
    inset: 0;
    background: rgba(246, 244, 238, 0.97);
    z-index: 200;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    overflow-y: auto;
    padding: 48px 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--transition-slow);
}

.overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.panel {
    width: 100%;
    max-width: 400px;
    padding: 0 24px;
    margin: auto 0;
}

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

.panel-back {
    font-family: var(--font-ui);
    font-size: 16px;
    font-weight: 300;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    transition: color var(--transition-med);
    width: 32px;
}

.panel-back:hover {
    color: var(--text);
}

.panel-back-spacer {
    width: 32px;
}

.panel-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 24px;
    text-align: center;
    flex: 1;
}

.panel-section {
    margin-bottom: 28px;
}

.panel-section-title {
    font-size: 11px;
    font-weight: 400;
    color: var(--text-light);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 12px;
}

.panel-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--divider);
}

.panel-row-label {
    font-size: 14px;
    font-weight: 300;
    color: var(--text);
}

.panel-row-controls {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 63px;
    justify-content: flex-end;
}

/* Toggle switch */
.toggle {
    position: relative;
    width: 36px;
    height: 20px;
    appearance: none;
    -webkit-appearance: none;
    background: var(--divider);
    border-radius: 10px;
    outline: none;
    cursor: pointer;
    transition: background var(--transition-med);
}

.toggle:checked {
    background: var(--accent);
}

.toggle::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: var(--surface);
    border-radius: 50%;
    transition: transform var(--transition-med);
}

.toggle:checked::before {
    transform: translateX(16px);
}

.panel-close {
    display: block;
    margin: 32px auto 0;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 16px;
    transition: color var(--transition-med);
}

.panel-close:hover {
    color: var(--text);
}

.panel-add-list {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
}

.panel-add-input {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 300;
    color: var(--text);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--divider);
    outline: none;
    padding: 6px 0;
    flex: 1;
}

.panel-add-input::placeholder {
    color: var(--text-ghost);
}

.panel-add-btn {
    font-size: 13px;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    transition: color var(--transition-med);
}

.panel-add-btn:hover {
    color: var(--text);
}

.panel-delete-btn {
    font-size: 11px;
    color: var(--text-ghost);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    transition: color var(--transition-med);
}

.panel-delete-btn:hover {
    color: var(--danger);
}

.panel-logout {
    display: block;
    margin: 8px auto 0;
    font-family: var(--font-ui);
    font-size: 11px;
    font-weight: 400;
    color: var(--text-ghost);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 16px;
    transition: color var(--transition-med);
}

.panel-logout:hover {
    color: var(--danger);
}

.panel-password-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 4px;
}

.panel-password-input {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 300;
    color: var(--text);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--divider);
    outline: none;
    padding: 6px 0;
    transition: border-color var(--transition-med);
}

.panel-password-input::placeholder {
    color: var(--text-ghost);
}

.panel-password-input:focus {
    border-bottom-color: var(--accent);
}

.panel-password-btn {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-light);
    background: none;
    border: 1px solid var(--divider);
    border-radius: 4px;
    padding: 8px 16px;
    cursor: pointer;
    align-self: flex-start;
    transition: border-color var(--transition-med), color var(--transition-med);
}

.panel-password-btn:hover {
    color: var(--text);
    border-color: var(--accent);
}

.panel-password-msg {
    font-size: 12px;
    min-height: 18px;
    transition: opacity 0.4s ease;
}

.panel-password-msg.success {
    color: var(--success);
}

.panel-password-msg.error {
    color: var(--danger);
}

/* ── Account Links (bottom of settings) ──────────────────── */

.panel-account-links {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    margin-top: 32px;
}

.panel-account-link {
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 16px;
    transition: color var(--transition-med);
}

.panel-account-link:hover {
    color: var(--text);
}

.panel-account-link.danger:hover {
    color: var(--danger);
}

/* ── Mini Modal ──────────────────────────────────────────── */

.mini-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(246, 244, 238, 0.97);
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s ease;
}

.mini-modal-overlay.visible {
    opacity: 1;
    pointer-events: all;
}

.mini-modal {
    width: 100%;
    max-width: 320px;
}

.mini-modal-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 20px;
    text-align: center;
    margin-bottom: 24px;
    color: var(--text);
}

.mini-modal-close {
    display: block;
    margin: 24px auto 0;
    font-family: var(--font-ui);
    font-size: 12px;
    font-weight: 400;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 16px;
    transition: color var(--transition-med);
}

.mini-modal-close:hover {
    color: var(--text);
}

/* ── Auth Pages ───────────────────────────────────────────── */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 24px;
}

.auth-card {
    width: 100%;
    max-width: 320px;
}

.auth-brand {
    display: block;
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 20px;
    color: var(--text-ghost);
    text-decoration: none;
    text-align: center;
    margin-bottom: 48px;
    transition: color var(--transition-med);
}

.auth-brand:hover {
    color: var(--text-light);
}

.auth-title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 28px;
    text-align: center;
    margin-bottom: 36px;
    color: var(--text);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.auth-input {
    font-family: var(--font-ui);
    font-size: 14px;
    font-weight: 300;
    color: var(--text);
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--divider);
    outline: none;
    padding: 8px 0;
    transition: border-color var(--transition-med);
}

.auth-input::placeholder {
    color: var(--text-ghost);
}

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

.auth-submit {
    font-family: var(--font-ui);
    font-size: 13px;
    font-weight: 400;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--divider);
    border-radius: 4px;
    padding: 10px 24px;
    cursor: pointer;
    margin-top: 8px;
    transition: border-color var(--transition-med), color var(--transition-med);
}

.auth-submit:hover {
    border-color: var(--accent);
}

.auth-switch {
    text-align: center;
    margin-top: 24px;
}

.auth-switch-link {
    font-size: 12px;
    color: var(--text-light);
    background: none;
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: color var(--transition-med);
}

.auth-switch-link:hover {
    color: var(--text);
}

.auth-error {
    font-size: 12px;
    color: var(--danger);
    text-align: center;
    min-height: 18px;
}

/* ── Animations ───────────────────────────────────────────── */

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

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

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

@keyframes strikethroughOut {
    0%   { text-decoration: none; opacity: 1; }
    40%  { text-decoration: line-through; text-decoration-color: var(--success); opacity: 1; }
    100% { text-decoration: line-through; text-decoration-color: var(--success); opacity: 0; }
}

@keyframes throwLeft {
    0%   { opacity: 1; transform: translateX(0) rotate(0deg); }
    100% { opacity: 0; transform: translateX(-120px) rotate(-8deg); }
}

@keyframes throwRight {
    0%   { opacity: 1; transform: translateX(0) rotate(0deg); }
    100% { opacity: 0; transform: translateX(120px) rotate(8deg); }
}

@keyframes breathe {
    0%, 100% { opacity: 0.3; }
    50%      { opacity: 0.6; }
}

/* ── Responsive ───────────────────────────────────────────── */

@media (min-width: 768px) {
    .item-title {
        font-size: 46px;
    }

    .tabs {
        padding-top: 64px;
        gap: 32px;
    }
}
