/* ══════════════════════════════════════════════════════════════════════════
   EnglishBot — Premium dark-mode design system
   Token spec: design_handoff_full §2
   ══════════════════════════════════════════════════════════════════════════ */

/* ── Tokens ───────────────────────────────────────────────────────────── */
:root {
    /* Surfaces */
    --eb-bg:          #0A0B0E;
    --eb-bg-elev:     #12141A;
    --eb-card:        #161921;
    --eb-card-hi:     #1C2029;
    --eb-card-grad:   linear-gradient(180deg, #161921 0%, #161921 100%);

    /* Borders (shadow-based) */
    --eb-border:        rgba(255,255,255,0.06);
    --eb-border-hi:     rgba(255,255,255,0.10);
    --eb-border-accent: rgba(47,134,255,0.35);

    /* Text */
    --eb-text:       #F5F6F8;
    --eb-text-mid:   rgba(245,246,248,0.72);
    --eb-text-dim:   rgba(245,246,248,0.48);
    --eb-text-faint: rgba(245,246,248,0.32);

    /* Accents */
    --eb-accent:      #2F86FF;
    --eb-accent-dim:  rgba(47,134,255,0.14);
    --eb-accent-soft: rgba(47,134,255,0.10);
    --eb-green:       #22C58B;
    --eb-orange:      #FF9A3D;
    --eb-purple:      #8B7BFF;
    --eb-pink:        #FF6BA8;
    --eb-teal:        #2EC4B6;
    --eb-streak:      #FFB36A;

    /* Gradients */
    --eb-cta-grad:      linear-gradient(135deg, #2F86FF 0%, #5A6EFF 50%, #7C5CFF 100%);
    --eb-cta-grad-b:    linear-gradient(135deg, #2F86FF, #5A6EFF);
    --eb-progress-grad: linear-gradient(90deg, #2F86FF, #7C5CFF);

    /* Shadows */
    --eb-shadow-cta:    0 12px 36px rgba(47,134,255,0.35), inset 0 1px 0 rgba(255,255,255,0.22);
    --eb-shadow-cta-hi: 0 16px 44px rgba(47,134,255,0.45), inset 0 1px 0 rgba(255,255,255,0.22);
    --eb-shadow-cta-sm: 0 8px 24px rgba(47,134,255,0.32), inset 0 1px 0 rgba(255,255,255,0.20);
    --eb-shadow-glow:   0 0 12px rgba(47,134,255,0.60);
    --eb-shadow-card:   inset 0 0 0 1px var(--eb-border);

    /* Type */
    --eb-font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
    --eb-font-feat: "cv11" on, "ss01" on, "ss03" on;

    /* Radii */
    --eb-r-pill:    999px;
    --eb-r-row:     16px;
    --eb-r-card:    18px;
    --eb-r-card-lg: 22px;
    --eb-r-icon:    10px;
    --eb-r-icon-lg: 12px;
    --eb-r-sheet:   28px;

    /* Timings */
    --eb-press: transform .15s ease;
    --eb-in:    cubic-bezier(.2, .8, .2, 1);

    /* Legacy aliases (JS-independent code & Telegram theme integration) */
    --bg:           var(--eb-bg);
    --bg-elev:      var(--eb-bg-elev);
    --text:         var(--eb-text);
    --hint:         var(--eb-text-dim);
    --link:         var(--eb-accent);
    --btn:          var(--eb-accent);
    --btn-text:     #ffffff;
    --secondary-bg: var(--eb-card);
    --card-shadow:  var(--eb-shadow-card);
    --card-shadow-active: 0 1px 2px rgba(0,0,0,0.4);
}

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

html, body {
    background: var(--eb-bg);
    color: var(--eb-text);
    font-family: var(--eb-font);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    overscroll-behavior: none;
}

.hidden { display: none !important; }

/* Views */
.view {
    display: none;
    padding: calc(16px + env(safe-area-inset-top)) 20px
             calc(24px + env(safe-area-inset-bottom));
    max-width: 520px;
    margin: 0 auto;
}
.view.active { display: block; animation: viewEnter 0.28s var(--eb-in) backwards; }

/* ── Keyframes ────────────────────────────────────────────────────────── */
@keyframes viewEnter {
    from { opacity: 0; transform: translateX(8%); }
    to   { opacity: 1; transform: translateX(0); }
}
@keyframes cardEnter {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes slideReveal {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.45; }
}
@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.92); }
    to   { opacity: 1; transform: scale(1); }
}
@keyframes bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30%           { transform: translateY(-6px); }
}
@keyframes toastIn {
    from { opacity: 0; transform: translateX(-50%) translateY(12px) scale(0.95); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0)  scale(1); }
}
@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50%      { transform: scale(1.12); }
}
@keyframes shimmer {
    0%   { background-position: -200% 0; }
    100% { background-position:  200% 0; }
}

/* ── Primitives ───────────────────────────────────────────────────────── */
.eb-row {
    width: 100%;
    padding: 14px 16px;
    border: 0;
    border-radius: var(--eb-r-row);
    background: var(--eb-card);
    box-shadow: var(--eb-shadow-card);
    color: var(--eb-text);
    font-family: var(--eb-font);
    display: flex;
    align-items: center;
    gap: 14px;
    text-align: left;
    cursor: pointer;
    transition: var(--eb-press);
    -webkit-tap-highlight-color: transparent;
}
.eb-row:active { transform: scale(0.985); }

.eb-row-icon {
    width: 36px;
    height: 36px;
    border-radius: var(--eb-r-icon);
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
    background: color-mix(in srgb, var(--dot, var(--eb-accent)) 13%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dot, var(--eb-accent)) 20%, transparent);
}

.eb-card {
    background: var(--eb-card);
    border-radius: var(--eb-r-card-lg);
    box-shadow: var(--eb-shadow-card);
    padding: 16px 18px;
    position: relative;
    overflow: hidden;
}

.eb-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 8px;
    border-radius: var(--eb-r-pill);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
}
.eb-chip--streak {
    background: rgba(255, 154, 61, 0.10);
    color: var(--eb-streak);
    box-shadow: inset 0 0 0 1px rgba(255, 154, 61, 0.22);
}
.eb-chip--level {
    background: var(--eb-accent-soft);
    color: #7FB1FF;
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
}
.eb-chip--tag {
    background: rgba(255, 255, 255, 0.05);
    color: var(--eb-text-mid);
    box-shadow: inset 0 0 0 1px var(--eb-border);
}

.eb-eyebrow {
    font-size: 11px;
    font-weight: 620;
    letter-spacing: 0.6px;
    color: var(--eb-text-dim);
    text-transform: uppercase;
    padding-left: 4px;
    margin-bottom: 10px;
}

.eb-cta {
    width: 100%;
    padding: 18px 20px;
    border: 0;
    border-radius: var(--eb-r-card);
    background: var(--eb-cta-grad-b);
    box-shadow: var(--eb-shadow-cta-sm);
    color: #fff;
    font-family: var(--eb-font);
    text-align: left;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: var(--eb-press), box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.eb-cta:active { transform: scale(0.985); }
@media (hover: hover) {
    .eb-cta:hover { box-shadow: var(--eb-shadow-cta-hi); }
}

.eb-tap { transition: var(--eb-press); -webkit-tap-highlight-color: transparent; }
.eb-tap:active { transform: scale(0.985); }

/* ── Typography ───────────────────────────────────────────────────────── */
h2 {
    font-size: 22px;
    font-weight: 680;
    letter-spacing: -0.5px;
    line-height: 1.2;
    color: var(--eb-text);
}

.title {
    font-size: 28px;
    font-weight: 720;
    letter-spacing: -0.8px;
    text-align: center;
    margin-top: 12px;
    color: var(--eb-text);
}
.subtitle {
    text-align: center;
    color: var(--eb-text-dim);
    margin: 4px 0 20px;
    font-size: 14px;
    font-weight: 500;
}
.section-label {
    font-size: 11px;
    font-weight: 620;
    letter-spacing: 0.6px;
    color: var(--eb-text-dim);
    text-transform: uppercase;
    margin: 22px 0 10px 4px;
}
.section-hint {
    color: var(--eb-text-dim);
    font-size: 13.5px;
    line-height: 1.5;
    margin-bottom: 18px;
}

/* ── Top bar (shared sub-screen nav) ──────────────────────────────────── */
.view-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.view-header h2 {
    flex: 1;
    margin: 0;
    font-size: 19px;
    font-weight: 640;
    letter-spacing: -0.3px;
}

.btn-icon-round {
    width: 36px;
    height: 36px;
    border-radius: var(--eb-r-pill);
    border: 0;
    background: var(--eb-cta-grad-b);
    color: #fff;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: var(--eb-shadow-cta-sm);
    transition: var(--eb-press);
    -webkit-tap-highlight-color: transparent;
}
.btn-icon-round:active { transform: scale(0.92); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.btn-primary {
    width: 100%;
    padding: 16px 20px;
    border: 0;
    border-radius: var(--eb-r-card);
    background: var(--eb-cta-grad-b);
    box-shadow: var(--eb-shadow-cta-sm);
    color: #fff;
    font-family: var(--eb-font);
    font-size: 16px;
    font-weight: 640;
    letter-spacing: -0.2px;
    cursor: pointer;
    transition: var(--eb-press), box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
    margin-top: 12px;
}
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; }
@media (hover: hover) {
    .btn-primary:hover:not(:disabled) { box-shadow: var(--eb-shadow-cta-hi); }
}

.btn-secondary {
    width: 100%;
    padding: 14px 18px;
    border: 0;
    border-radius: var(--eb-r-row);
    background: var(--eb-card);
    box-shadow: var(--eb-shadow-card);
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 15px;
    font-weight: 620;
    cursor: pointer;
    transition: var(--eb-press);
    -webkit-tap-highlight-color: transparent;
}
.btn-secondary:active { transform: scale(0.985); }

.btn-audio {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border: 0;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 255, 255, 0.06);
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 12.5px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--eb-press), background 0.15s;
    -webkit-tap-highlight-color: transparent;
    box-shadow: inset 0 0 0 1px var(--eb-border);
}
.btn-audio:active { transform: scale(0.96); background: rgba(255, 255, 255, 0.10); }

/* ── Inputs ───────────────────────────────────────────────────────────── */
input[type="text"],
input[type="password"],
input[type="email"],
input[type="search"],
textarea {
    width: 100%;
    background: var(--eb-card);
    border: 0;
    box-shadow: var(--eb-shadow-card);
    border-radius: var(--eb-r-row);
    padding: 14px 16px;
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 16px;
    font-weight: 500;
    line-height: 1.4;
    resize: none;
    outline: 0;
    transition: box-shadow 0.15s;
    margin-bottom: 4px;
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="email"]:focus,
input[type="search"]:focus,
textarea:focus {
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
}
input::placeholder,
textarea::placeholder {
    color: var(--eb-text-faint);
}

/* ── Misc helpers ─────────────────────────────────────────────────────── */
.loading {
    text-align: center;
    padding: 20px;
    color: var(--eb-text-dim);
    font-size: 14px;
    animation: pulse 1.4s ease-in-out infinite;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--eb-text-dim);
}
.empty-state p {
    font-size: 15px;
    line-height: 1.5;
    margin-top: 8px;
}
.empty-icon {
    font-size: 48px;
    margin-bottom: 8px;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: calc(28px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    background: var(--eb-card-hi);
    color: var(--eb-text);
    font-size: 14px;
    font-weight: 500;
    padding: 12px 18px;
    border-radius: var(--eb-r-pill);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), inset 0 0 0 1px var(--eb-border-hi);
    z-index: 2000;
    animation: toastIn 0.22s var(--eb-in) both;
}

/* ══════════════════════════════════════════════════════════════════════════
   Home — Focus variant
   ══════════════════════════════════════════════════════════════════════════ */
#view-home:has(.home-focus) {
    padding: 0;
    max-width: 520px;
}

.home-focus {
    background: var(--eb-bg);
    color: var(--eb-text);
    min-height: 100dvh;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

.home-focus-hero {
    position: relative;
    padding: 64px 24px 0;
}
.home-focus-hero-glow {
    position: absolute;
    top: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(47, 134, 255, 0.22), transparent 60%);
    filter: blur(20px);
    pointer-events: none;
}
.home-focus-streak-chip {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px 4px 8px;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 154, 61, 0.10);
    box-shadow: inset 0 0 0 1px rgba(255, 154, 61, 0.22);
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.2;
    color: var(--eb-streak);
}
.home-focus-headline {
    position: relative;
    margin-top: 14px;
    font-size: 34px;
    font-weight: 800;
    letter-spacing: -1.2px;
    line-height: 1.05;
    display: flex;
    flex-direction: column;
}
.home-focus-headline-main { color: var(--eb-text); }
.home-focus-headline-sub  { color: var(--eb-text-dim); }

.home-focus-progress { padding: 20px 24px 0; }
.home-focus-progress-header {
    display: flex;
    justify-content: space-between;
    font-size: 12.5px;
    line-height: 1.2;
    color: var(--eb-text-dim);
    margin-bottom: 8px;
}
.home-focus-progress-header strong { color: var(--eb-text); font-weight: 600; }
.home-focus-progress-bar {
    height: 6px;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 255, 255, 0.07);
    overflow: hidden;
}
.home-focus-progress-fill {
    height: 100%;
    background: var(--eb-progress-grad);
    border-radius: var(--eb-r-pill);
    box-shadow: var(--eb-shadow-glow);
    animation: homeFocusFill 600ms var(--eb-in) both;
}
@keyframes homeFocusFill { from { width: 0 !important; } }

.home-focus-cta-wrap { padding: 22px 20px 0; }
.home-focus-cta {
    width: 100%;
    padding: 22px;
    border: 0;
    border-radius: var(--eb-r-card-lg);
    background: var(--eb-cta-grad);
    box-shadow: var(--eb-shadow-cta);
    color: #fff;
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: var(--eb-press), box-shadow 0.2s;
    -webkit-tap-highlight-color: transparent;
}
.home-focus-cta:active { transform: scale(0.985); }
@media (hover: hover) {
    .home-focus-cta:hover { box-shadow: var(--eb-shadow-cta-hi); }
}
.home-focus-cta-text { flex: 1; text-align: left; min-width: 0; }
.home-focus-cta-eyebrow {
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    opacity: 0.8;
    line-height: 1.2;
}
.home-focus-cta-title {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
    line-height: 1.1;
    margin-top: 2px;
}
.home-focus-cta-sub {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    opacity: 0.88;
    margin-top: 4px;
}
.home-focus-cta-arrow {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 255, 255, 0.20);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.30);
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-focus-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 22px 20px 0;
}
.home-focus-row {
    width: 100%;
    padding: 14px 16px;
    border: 0;
    border-radius: var(--eb-r-row);
    background: var(--eb-card);
    box-shadow: var(--eb-shadow-card);
    color: var(--eb-text);
    display: flex;
    align-items: center;
    gap: 14px;
    cursor: pointer;
    transition: var(--eb-press);
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
}
.home-focus-row:active { transform: scale(0.985); }
.home-focus-row-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: var(--eb-r-icon);
    background: color-mix(in srgb, var(--dot) 13%, transparent);
    box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--dot) 20%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    line-height: 1;
}
.home-focus-row-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    text-align: left;
}
.home-focus-row-label {
    font-size: 15px;
    font-weight: 620;
    letter-spacing: -0.2px;
    line-height: 1.3;
    color: var(--eb-text);
}
.home-focus-row-sub {
    font-size: 12.5px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--eb-text-dim);
    margin-top: 2px;
}
.home-focus-row-chevron {
    flex-shrink: 0;
    color: var(--eb-text-faint);
}
.home-focus-spacer { height: 32px; }

/* ══════════════════════════════════════════════════════════════════════════
   Legacy home (stats-bar / hero-cards / tool-grid) — retained for safety
   ══════════════════════════════════════════════════════════════════════════ */
.stats-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}
.stat {
    flex: 1;
    background: var(--eb-card);
    box-shadow: var(--eb-shadow-card);
    border-radius: var(--eb-r-row);
    padding: 12px;
    text-align: center;
}
.stat span {
    display: block;
    font-size: 24px;
    font-weight: 720;
    letter-spacing: -0.5px;
    color: var(--eb-text);
}
.stat small {
    display: block;
    margin-top: 4px;
    font-size: 11.5px;
    font-weight: 600;
    color: var(--eb-text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.hero-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.hero-card {
    border: 0; text-align: left; cursor: pointer; font-family: inherit;
    background: var(--eb-card); box-shadow: var(--eb-shadow-card);
    border-radius: var(--eb-r-card); padding: 14px;
    display: flex; flex-direction: column; gap: 6px;
    color: var(--eb-text);
    transition: var(--eb-press);
}
.hero-card:active { transform: scale(0.985); }
.hero-card strong { font-size: 15px; font-weight: 620; }
.hero-card small { font-size: 12.5px; color: var(--eb-text-dim); }
.hero-card-icon {
    width: 36px; height: 36px; border-radius: var(--eb-r-icon);
    display: flex; align-items: center; justify-content: center;
}
.hero-card-count { font-size: 22px; font-weight: 720; letter-spacing: -0.5px; }
.hero-card.has-due .hero-card-count { color: var(--eb-accent); }

.featured-card {
    width: 100%; border: 0; cursor: pointer; font-family: inherit; text-align: left;
    background: var(--eb-card); box-shadow: var(--eb-shadow-card);
    border-radius: var(--eb-r-card); padding: 14px;
    display: flex; align-items: center; gap: 12px; color: var(--eb-text);
    margin-bottom: 12px; transition: var(--eb-press);
}
.featured-card:active { transform: scale(0.985); }
.featured-card-icon {
    width: 44px; height: 44px; border-radius: var(--eb-r-icon-lg);
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.featured-card-text strong { display: block; font-size: 16px; font-weight: 640; }
.featured-card-text small  { display: block; font-size: 12.5px; color: var(--eb-text-dim); margin-top: 2px; }

.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tool-card {
    border: 0; text-align: left; cursor: pointer; font-family: inherit;
    background: var(--eb-card); box-shadow: var(--eb-shadow-card);
    border-radius: var(--eb-r-card); padding: 14px;
    display: flex; flex-direction: column; gap: 6px;
    color: var(--eb-text); transition: var(--eb-press); min-height: 96px;
}
.tool-card:active { transform: scale(0.985); }
.tool-card strong { font-size: 15px; font-weight: 620; }
.tool-card small  { font-size: 12.5px; color: var(--eb-text-dim); }
.tool-card-icon {
    width: 34px; height: 34px; border-radius: var(--eb-r-icon);
    display: flex; align-items: center; justify-content: center;
}

/* Icon color variants */
.icon-amber   { background: rgba(255, 154, 61, 0.14);  color: var(--eb-orange); box-shadow: inset 0 0 0 1px rgba(255, 154, 61, 0.22); }
.icon-indigo  { background: rgba(139, 123, 255, 0.14); color: var(--eb-purple); box-shadow: inset 0 0 0 1px rgba(139, 123, 255, 0.22); }
.icon-emerald { background: rgba(34, 197, 139, 0.14);  color: var(--eb-green);  box-shadow: inset 0 0 0 1px rgba(34, 197, 139, 0.22); }
.icon-violet  { background: rgba(139, 123, 255, 0.14); color: var(--eb-purple); box-shadow: inset 0 0 0 1px rgba(139, 123, 255, 0.22); }
.icon-blue    { background: rgba(47, 134, 255, 0.14);  color: var(--eb-accent); box-shadow: inset 0 0 0 1px rgba(47, 134, 255, 0.22); }
.icon-pink    { background: rgba(255, 107, 168, 0.14); color: var(--eb-pink);   box-shadow: inset 0 0 0 1px rgba(255, 107, 168, 0.22); }
.icon-teal    { background: rgba(46, 196, 182, 0.14);  color: var(--eb-teal);   box-shadow: inset 0 0 0 1px rgba(46, 196, 182, 0.22); }

/* ══════════════════════════════════════════════════════════════════════════
   Generate screen
   ══════════════════════════════════════════════════════════════════════════ */
#view-generate { padding: 0; }

.eb-generate-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(56px + env(safe-area-inset-top)) 20px 14px;
}
.eb-generate-title {
    flex: 1;
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    letter-spacing: -0.5px;
    color: var(--eb-text);
}

.eb-generate-core-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.eb-generate-speaker {
    width: 36px;
    height: 36px;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 255, 255, 0.06);
    border: 0;
    color: var(--eb-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--eb-press);
    flex-shrink: 0;
}
.eb-generate-speaker:active { transform: scale(0.94); }
.eb-generate-speaker svg { width: 16px; height: 16px; stroke-width: 1.8; }
.eb-generate-core {
    margin: 0;
    font-size: 18px;
    font-weight: 680;
    letter-spacing: -0.3px;
    line-height: 1.3;
    color: var(--eb-text);
}

/* ══════════════════════════════════════════════════════════════════════════
   Review screen
   ══════════════════════════════════════════════════════════════════════════ */
#view-review { padding: 0; }
.eb-review-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(56px + env(safe-area-inset-top)) 20px 14px;
}
.eb-back-pill {
    width: 36px;
    height: 36px;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 255, 255, 0.06);
    border: 0;
    color: var(--eb-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--eb-press);
}
.eb-back-pill:active { transform: scale(0.94); }
.eb-back-pill svg { width: 18px; height: 18px; stroke-width: 1.8; }

.eb-review-progress-bar {
    flex: 1;
    display: flex;
    gap: 4px;
    /* Let counter stay visible when many segments render (prevents overflow push). */
    min-width: 0;
}
.eb-review-progress-seg {
    flex: 1;
    height: 3px;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 255, 255, 0.08);
    transition: background 0.3s var(--eb-in);
}
.eb-review-progress-seg.done    { background: var(--eb-green); }
.eb-review-progress-seg.current { background: var(--eb-accent); }

.eb-review-counter {
    font-size: 13px;
    color: var(--eb-text-dim);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
    letter-spacing: 0.2px;
}

.eb-review-card {
    position: relative;
    margin: 8px 20px 0;
    padding: 32px 24px;
    min-height: 360px;
    border-radius: 24px;
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border), 0 10px 30px rgba(0, 0, 0, 0.30);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    animation: cardEnter 0.3s var(--eb-in);
}
.eb-review-card:focus-visible {
    outline: 2px solid var(--eb-accent);
    outline-offset: 3px;
}
.eb-review-card-glow {
    position: absolute;
    top: -80px;
    left: -80px;
    width: 220px;
    height: 220px;
    background: radial-gradient(circle, color-mix(in srgb, var(--eb-accent) 16%, transparent), transparent 65%);
    pointer-events: none;
}

.eb-review-card-top {
    position: relative;
    display: flex;
    justify-content: flex-start;
}
.eb-review-dir-chip {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    color: var(--eb-text-mid);
    font-size: 11px;
    font-weight: 620;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.eb-review-dir-chip[hidden] { display: none; }

/* Active-recall auto-grade badge (Plan 01-02). Composes .eb-review-dir-chip geometry
   with .rate-fail/hard/good colour recipes — no new colour tokens introduced. */
.eb-review-grade-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    margin: 20px 0 0;
    border-radius: var(--eb-r-pill);
    font-size: 11px;
    font-weight: 620;
    letter-spacing: 0.4px;
    text-transform: uppercase;
}
.eb-review-grade-badge svg { width: 14px; height: 14px; stroke-width: 2; }
.eb-review-grade-desc {
    font-size: 12.5px;
    font-weight: 560;
    text-transform: none;
    letter-spacing: 0;
    opacity: 0.82;
}

.eb-review-grade-badge--good {
    background: rgba(47, 134, 255, 0.12);
    color: var(--eb-accent);
    box-shadow: inset 0 0 0 1px rgba(47, 134, 255, 0.30);
}
.eb-review-grade-badge--hard {
    background: rgba(255, 154, 61, 0.12);
    color: var(--eb-orange);
    box-shadow: inset 0 0 0 1px rgba(255, 154, 61, 0.30);
}
.eb-review-grade-badge--again {
    background: rgba(255, 107, 168, 0.12);
    color: var(--eb-pink);
    box-shadow: inset 0 0 0 1px rgba(255, 107, 168, 0.30);
}

.eb-review-query {
    position: relative;
    margin: 40px 0 0;
    font-size: 28px;
    font-weight: 720;
    letter-spacing: -0.8px;
    line-height: 1.15;
    color: var(--eb-text);
    text-align: left;
}

.eb-review-reveal {
    position: relative;
    margin-top: 28px;
    display: none;
    flex-direction: column;
}
.eb-review-card.revealed .eb-review-reveal {
    display: flex;
    animation: slideReveal 0.28s var(--eb-in);
}
.eb-review-card.revealed { cursor: default; }

.eb-review-reveal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.eb-review-eyebrow {
    font-size: 11px;
    font-weight: 620;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--eb-text-dim);
}
.eb-review-speaker {
    width: 40px;
    height: 40px;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 255, 255, 0.06);
    border: 0;
    color: var(--eb-text);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--eb-press);
}
.eb-review-speaker:active { transform: scale(0.94); }
.eb-review-speaker svg { width: 18px; height: 18px; stroke-width: 1.8; }

.eb-review-core {
    margin: 6px 0 0;
    font-size: 22px;
    font-weight: 680;
    letter-spacing: -0.3px;
    line-height: 1.3;
    color: var(--eb-text);
}

.eb-review-group {
    margin-top: 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.eb-review-group[hidden] { display: none; }

.eb-review-variations {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(47, 134, 255, 0.08);
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
    font-size: 14.5px;
    line-height: 1.45;
    color: var(--eb-text);
}
.eb-review-note {
    margin: 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--eb-text-mid);
}

.eb-review-hint {
    position: relative;
    margin: auto 0 0;
    padding-top: 24px;
    text-align: center;
    font-size: 13px;
    color: var(--eb-text-dim);
}
.eb-review-card.revealed .eb-review-hint { display: none; }

.eb-review-actions {
    margin: 16px 20px 24px;
}
.eb-review-show-btn {
    width: 100%;
    padding: 16px;
    border: 0;
    border-radius: 16px;
    background: var(--eb-text);
    color: #000;
    font-family: var(--eb-font);
    font-size: 16px;
    font-weight: 680;
    letter-spacing: -0.2px;
    cursor: pointer;
    transition: var(--eb-press);
}
.eb-review-show-btn:active { transform: scale(0.985); }

.eb-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 80px 24px 24px;
    text-align: center;
}
.eb-empty-icon { font-size: 56px; line-height: 1; }
.eb-empty-title {
    margin: 0;
    font-size: 17px;
    font-weight: 680;
    color: var(--eb-text);
}
.eb-empty-cta {
    margin-top: 4px;
    padding: 14px 22px;
    border: 0;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.06);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 15px;
    font-weight: 620;
    cursor: pointer;
    transition: var(--eb-press);
}
.eb-empty-cta:active { transform: scale(0.97); }

#view-vocab-review { padding: 0; }

.eb-review-example {
    margin: 0;
    font-size: 14px;
    line-height: 1.5;
    color: var(--eb-text);
    font-style: italic;
}
.eb-review-example-tr {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--eb-text-dim);
}

.rating-buttons {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-top: 20px;
}
.rate-btn {
    height: 64px;
    border: 0;
    border-radius: var(--eb-r-row);
    font-family: var(--eb-font);
    font-size: 14px;
    font-weight: 640;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: var(--eb-press);
    -webkit-tap-highlight-color: transparent;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 0;
}
.rate-btn:active { transform: scale(0.96); }
.rate-btn-label {
    font-size: 14px;
    font-weight: 640;
    line-height: 1.1;
}
.rate-btn-sub {
    font-size: 11px;
    font-weight: 620;
    opacity: 0.72;
    letter-spacing: 0.3px;
}
.rate-fail { background: rgba(255, 107, 168, 0.12); color: var(--eb-pink);   box-shadow: inset 0 0 0 1px rgba(255, 107, 168, 0.30); }
.rate-hard { background: rgba(255, 154, 61, 0.12);  color: var(--eb-orange); box-shadow: inset 0 0 0 1px rgba(255, 154, 61, 0.30); }
.rate-good { background: rgba(47, 134, 255, 0.12);  color: var(--eb-accent); box-shadow: inset 0 0 0 1px var(--eb-border-accent); }
.rate-easy { background: rgba(34, 197, 139, 0.12);  color: var(--eb-green);  box-shadow: inset 0 0 0 1px rgba(34, 197, 139, 0.30); }

/* ══════════════════════════════════════════════════════════════════════════
   Smart Dialog — topic selection
   ══════════════════════════════════════════════════════════════════════════ */
#view-dialog-topic { padding: 0; }

.eb-dialog-topic-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(56px + env(safe-area-inset-top)) 20px 14px;
}
.eb-dialog-topic-title {
    flex: 1;
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    letter-spacing: -0.5px;
    color: var(--eb-text);
}

.eb-dialog-topic-hint {
    margin: 0 20px 16px;
    font-size: 14px;
    color: var(--eb-text-mid);
    line-height: 1.45;
}

.eb-dialog-topic-eyebrow {
    display: block;
    margin: 0 24px 10px;
}
.eb-dialog-topic-eyebrow--spaced { margin-top: 22px; }

.eb-dialog-topic-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 0 20px;
}
.eb-dialog-topic-card {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 12px;
    border: 0;
    border-radius: 16px;
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    color: var(--eb-text);
    font-family: var(--eb-font);
    text-align: left;
    cursor: pointer;
    transition: var(--eb-press), box-shadow 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
    min-height: 110px;
}
.eb-dialog-topic-card:active { transform: scale(0.985); }
.eb-dialog-topic-card:focus-visible {
    outline: none;
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
}
.eb-dialog-topic-card-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    line-height: 1;
    flex-shrink: 0;
}
.eb-dialog-topic-card-label {
    font-size: 13.5px;
    font-weight: 620;
    letter-spacing: -0.15px;
    line-height: 1.25;
    color: var(--eb-text);
}

/* ══════════════════════════════════════════════════════════════════════════
   Chat shell (Dialog + Theory share these primitives)
   ══════════════════════════════════════════════════════════════════════════ */
.eb-chat-view {
    display: none;
    flex-direction: column;
    padding: 0;
    height: 100dvh;
    animation: none;
}
.eb-chat-view.active { display: flex; animation: none; }

.eb-chat-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(16px + env(safe-area-inset-top)) 20px 12px;
    background: var(--eb-bg);
    border-bottom: 1px solid var(--eb-border);
    flex-shrink: 0;
}
.eb-chat-title {
    flex: 1;
    margin: 0;
    font-size: 17px;
    font-weight: 680;
    letter-spacing: -0.2px;
    color: var(--eb-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.eb-chat-messages {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 20px 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.eb-chat-messages::-webkit-scrollbar { width: 0; }

.eb-chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 82%;
    animation: cardEnter 0.24s var(--eb-in);
}
.eb-chat-msg--user      { align-self: flex-end;   align-items: flex-end; }
.eb-chat-msg--assistant { align-self: flex-start; align-items: flex-start; }

.eb-chat-bubble {
    padding: 10px 14px;
    font-size: 14.5px;
    line-height: 1.45;
    word-wrap: break-word;
    border-radius: 18px;
}
.eb-chat-msg--assistant .eb-chat-bubble {
    background: var(--eb-card-grad);
    color: var(--eb-text);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    border-bottom-left-radius: 6px;
}
.eb-chat-msg--user .eb-chat-bubble {
    background: var(--eb-cta-grad-b);
    color: #fff;
    box-shadow: 0 4px 12px rgba(47, 134, 255, 0.25);
    border-bottom-right-radius: 6px;
}

.eb-chat-typing {
    display: inline-flex;
    gap: 4px;
    padding: 14px 16px !important;
}
.eb-chat-typing span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--eb-text-dim);
    animation: bounce 1.2s infinite;
}
.eb-chat-typing span:nth-child(2) { animation-delay: 0.12s; }
.eb-chat-typing span:nth-child(3) { animation-delay: 0.24s; }

.eb-chat-input-area {
    flex-shrink: 0;
    padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
    background: var(--eb-bg);
    border-top: 1px solid var(--eb-border);
}
.eb-chat-input-pill {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 6px 6px 6px 16px;
    border-radius: 22px;
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    transition: box-shadow 0.15s ease;
}
.eb-chat-input-pill:focus-within { box-shadow: inset 0 0 0 1px var(--eb-border-accent); }
.eb-chat-input-field {
    flex: 1;
    background: transparent;
    border: 0;
    outline: none;
    resize: none;
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 16px;
    font-weight: 400;
    padding: 8px 0;
    margin: 0;
    max-height: 100px;
    line-height: 1.4;
    min-width: 0;
    box-shadow: none;
    border-radius: 0;
    transition: none;
}
.eb-chat-input-field::placeholder { color: var(--eb-text-faint); }
.eb-chat-send {
    width: 36px;
    height: 36px;
    border-radius: 999px;
    border: 0;
    background: var(--eb-accent);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: var(--eb-press), background 0.15s, box-shadow 0.15s;
    box-shadow: 0 4px 10px rgba(47, 134, 255, 0.3);
}
.eb-chat-send:active { transform: scale(0.92); }
.eb-chat-send[disabled] {
    cursor: default;
    background: rgba(255, 255, 255, 0.08);
    color: var(--eb-text-faint);
    box-shadow: none;
}
.eb-chat-send svg { width: 18px; height: 18px; stroke-width: 2.4; }

/* ── Dialog-only chat extras (correction / theory block / capture / banner) ── */

.eb-chat-correction {
    margin-top: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    display: flex;
    flex-direction: column;
    gap: 4px;
    max-width: 82%;
    align-self: flex-end;
}
.eb-chat-correction-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 13px;
    line-height: 1.4;
}
.eb-chat-correction-label {
    font-size: 10.5px;
    font-weight: 620;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: var(--eb-text-dim);
    flex-shrink: 0;
    padding-top: 2px;
    min-width: 60px;
}
.eb-chat-correction-row--better .eb-chat-correction-text { color: var(--eb-green); font-weight: 620; }
.eb-chat-correction-icon { color: var(--eb-orange); font-size: 13px; flex-shrink: 0; }
.eb-chat-correction-text { color: var(--eb-text); }
.eb-chat-correction-reason { color: var(--eb-text-mid); }
.eb-chat-btn-theory {
    align-self: flex-start;
    margin-top: 4px;
    padding: 6px 10px;
    border: 0;
    border-radius: 10px;
    background: rgba(47, 134, 255, 0.10);
    box-shadow: inset 0 0 0 1px rgba(47, 134, 255, 0.28);
    color: var(--eb-accent);
    font-family: var(--eb-font);
    font-size: 12px;
    font-weight: 620;
    cursor: pointer;
    transition: var(--eb-press);
}
.eb-chat-btn-theory:active { transform: scale(0.97); }
.eb-chat-btn-theory[disabled] { opacity: 0.6; cursor: default; }

.eb-chat-theory-block {
    align-self: flex-start;
    margin-top: 8px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(47, 134, 255, 0.08);
    box-shadow: inset 0 0 0 1px rgba(47, 134, 255, 0.22);
    border-left: 2px solid var(--eb-accent);
    font-size: 13px;
    line-height: 1.5;
    color: var(--eb-text);
    white-space: pre-wrap;
}

.eb-chat-capture {
    align-self: flex-start;
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    border-radius: 14px;
    padding: 10px 12px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 13px;
    max-width: 82%;
}
.eb-chat-capture-text { color: var(--eb-text-mid); line-height: 1.4; }
.eb-chat-capture-text--done { color: var(--eb-green); font-weight: 620; }
.eb-chat-capture-btn {
    padding: 6px 12px;
    border: 0;
    border-radius: 999px;
    background: var(--eb-cta-grad-b);
    color: #fff;
    font-family: var(--eb-font);
    font-size: 12px;
    font-weight: 640;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(47, 134, 255, 0.25);
    transition: var(--eb-press);
    flex-shrink: 0;
}
.eb-chat-capture-btn:active { transform: scale(0.95); }

.eb-chat-banner {
    align-self: stretch;
    text-align: center;
    padding: 10px 14px;
    border-radius: 14px;
    font-family: var(--eb-font);
    font-size: 13px;
    font-weight: 620;
}
.eb-chat-banner--success {
    background: rgba(34, 197, 139, 0.10);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 139, 0.28);
    color: var(--eb-green);
}
.eb-chat-banner--capture-summary {
    background: var(--eb-accent-soft);
    box-shadow: inset 0 0 0 1px rgba(47, 134, 255, 0.28);
    color: var(--eb-accent);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: var(--eb-press);
    margin: 0 16px 8px;
    flex-shrink: 0;
}
.eb-chat-banner--capture-summary:active { transform: scale(0.98); }

/* ══════════════════════════════════════════════════════════════════════════
   Smart Dialog — practice strip (chat-view only, not shared with Theory)
   ══════════════════════════════════════════════════════════════════════════ */
.eb-dialog-practice-strip {
    padding: 10px 12px;
    margin: 0 20px 8px;
    border-radius: 12px;
    background: rgba(124, 92, 255, 0.06);
    box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.22);
    display: flex;
    align-items: center;
    gap: 10px;
    overflow-x: auto;
    flex-shrink: 0;
}
.eb-dialog-practice-strip[hidden] { display: none; }
.eb-dialog-practice-strip::-webkit-scrollbar { height: 0; }
.eb-dialog-practice-eyebrow {
    font-size: 10.5px;
    font-weight: 620;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #A596FF;
    flex-shrink: 0;
}
.eb-dialog-practice-chips {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: nowrap;
}
.eb-dialog-practice-chip {
    background: rgba(124, 92, 255, 0.14);
    box-shadow: inset 0 0 0 1px rgba(124, 92, 255, 0.30);
    border-radius: 999px;
    padding: 4px 9px 4px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 520;
    color: #C0B5FF;
    flex-shrink: 0;
    max-width: 180px;
}
.eb-dialog-practice-chip.used {
    background: rgba(34, 197, 139, 0.14);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 139, 0.30);
    color: var(--eb-green);
}
.eb-dialog-practice-chip-text {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.eb-dialog-practice-chip-hint-btn {
    border: 0;
    background: transparent;
    cursor: pointer;
    font-size: 13px;
    padding: 0 2px;
    color: var(--eb-streak);
    line-height: 1;
    flex-shrink: 0;
}
.eb-dialog-practice-chip-hint-text {
    flex-basis: 100%;
    font-size: 11.5px;
    font-weight: 500;
    color: var(--eb-text-mid);
    margin-top: 4px;
    line-height: 1.4;
    white-space: normal;
}

/* Theory-chat: Save Rule button in header (pill, accent-tinted) */
.eb-chat-save-rule {
    padding: 7px 12px;
    border: 0;
    border-radius: var(--eb-r-pill);
    background: var(--eb-accent-dim);
    color: var(--eb-accent);
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
    font-family: var(--eb-font);
    font-size: 12.5px;
    font-weight: 640;
    cursor: pointer;
    transition: var(--eb-press);
}
.eb-chat-save-rule:active { transform: scale(0.95); }
.eb-chat-save-rule:disabled { opacity: 0.5; cursor: not-allowed; }

.rule-saved-card {
    align-self: stretch;
    background: var(--eb-card);
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
    border-radius: 16px;
    padding: 14px 16px;
    animation: cardEnter 0.28s var(--eb-in);
}
.rule-saved-title {
    font-size: 15px;
    font-weight: 640;
    color: var(--eb-text);
    margin-bottom: 6px;
}
.rule-saved-content {
    font-size: 13.5px;
    line-height: 1.5;
    color: var(--eb-text-mid);
    margin-bottom: 8px;
}
.rule-saved-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* ══════════════════════════════════════════════════════════════════════════
   Dictionary
   ══════════════════════════════════════════════════════════════════════════ */
#view-dictionary { padding: 0; }

.eb-dict-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(56px + env(safe-area-inset-top)) 20px 14px;
}
.eb-dict-title {
    flex: 1;
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    letter-spacing: -0.5px;
    color: var(--eb-text);
}

.eb-dict-search {
    margin: 4px 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--eb-r-card);
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    transition: box-shadow 0.15s ease;
}
.eb-dict-search:focus-within {
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
}
.eb-dict-search-icon {
    width: 18px;
    height: 18px;
    color: var(--eb-text-faint);
    flex-shrink: 0;
}
.eb-dict-search-input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: none;
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 16px;
    padding: 0;
    min-width: 0;
}
.eb-dict-search-input::placeholder { color: var(--eb-text-faint); }

.eb-dict-eyebrow {
    margin: 18px 24px 10px;
    font-size: 11px;
    font-weight: 620;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--eb-text-dim);
}
.eb-dict-eyebrow[hidden] { display: none; }

.eb-dict-list {
    margin: 0 20px calc(28px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.eb-dict-list:empty { display: none; }

.eb-dict-card {
    padding: 14px 16px;
    border-radius: 16px;
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    cursor: pointer;
    overflow: hidden;
    animation: cardEnter 0.24s var(--eb-in);
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.eb-dict-card:active { background: rgba(255, 255, 255, 0.02); }
.eb-dict-card:focus-visible {
    outline: 2px solid var(--eb-accent);
    outline-offset: 2px;
}

.eb-dict-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.eb-dict-date {
    font-size: 12px;
    color: var(--eb-text-faint);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.eb-dict-phrase {
    margin: 10px 0 0;
    font-size: 16px;
    font-weight: 640;
    letter-spacing: -0.2px;
    line-height: 1.3;
    color: var(--eb-text);
}
.eb-dict-note {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.45;
    color: var(--eb-text-dim);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.eb-dict-card.expanded .eb-dict-note {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
}

.eb-dict-card-expanded {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--eb-border);
    flex-direction: column;
    gap: 12px;
    animation: slideReveal 0.24s var(--eb-in);
}
.eb-dict-card.expanded .eb-dict-card-expanded { display: flex; }

.eb-dict-meta {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.eb-dict-meta-row { display: flex; flex-direction: column; gap: 2px; }
.eb-dict-meta-row[hidden] { display: none; }
.eb-dict-meta-label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--eb-text-faint);
}
.eb-dict-meta-value {
    font-size: 13.5px;
    line-height: 1.4;
    color: var(--eb-text-mid);
}

.eb-dict-rule-hint {
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border: 0;
    border-radius: 12px;
    background: rgba(47, 134, 255, 0.08);
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
    color: #7FB1FF;
    font-family: var(--eb-font);
    font-size: 12.5px;
    font-weight: 620;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: var(--eb-press);
}
.eb-dict-rule-hint:active { transform: scale(0.98); }
.eb-dict-rule-hint-caret {
    font-size: 10px;
    transition: transform 0.18s var(--eb-in);
}
.eb-dict-rule-hint.expanded .eb-dict-rule-hint-caret { transform: rotate(180deg); }
.eb-dict-rule-body {
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    color: var(--eb-text-mid);
    font-size: 12.5px;
    line-height: 1.5;
    white-space: pre-wrap;
    animation: slideReveal 0.2s var(--eb-in);
}
.eb-dict-rule-body[hidden] { display: none; }

.eb-dict-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.eb-dict-listen {
    padding: 7px 14px;
    border: 0;
    border-radius: 12px;
    background: rgba(47, 134, 255, 0.12);
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
    color: #7FB1FF;
    font-family: var(--eb-font);
    font-size: 12.5px;
    font-weight: 620;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: var(--eb-press);
}
.eb-dict-listen:active { transform: scale(0.96); }
.eb-dict-delete {
    padding: 7px 14px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 107, 168, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 107, 168, 0.30);
    color: var(--eb-pink);
    font-family: var(--eb-font);
    font-size: 12.5px;
    font-weight: 620;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: var(--eb-press);
}
.eb-dict-delete:active { transform: scale(0.96); }

/* ══════════════════════════════════════════════════════════════════════════
   Vocabulary (list)
   ══════════════════════════════════════════════════════════════════════════ */
#view-vocab { padding: 0; }

.eb-vocab-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(56px + env(safe-area-inset-top)) 20px 14px;
}
.eb-vocab-title {
    flex: 1;
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    letter-spacing: -0.5px;
    color: var(--eb-text);
}
.eb-vocab-add-btn {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--eb-r-pill);
    background: var(--eb-cta-grad-b);
    box-shadow: var(--eb-shadow-cta-sm);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: var(--eb-press);
}
.eb-vocab-add-btn:active { transform: scale(0.94); }
.eb-vocab-add-btn svg { width: 18px; height: 18px; stroke-width: 2; }

.eb-vocab-stats {
    margin: 4px 20px 0;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    background: var(--eb-card-grad);
    border-radius: var(--eb-r-card);
    box-shadow: var(--eb-shadow-card);
    padding: 14px 8px;
}
.eb-vocab-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    border-left: 1px solid var(--eb-border);
}
.eb-vocab-stat:first-child { border-left: 0; }
.eb-vocab-stat-num {
    font-size: 26px;
    font-weight: 720;
    letter-spacing: -0.6px;
    font-variant-numeric: tabular-nums;
    line-height: 1.05;
}
.eb-vocab-stat-label {
    font-size: 10.5px;
    font-weight: 620;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--eb-text-dim);
}
.eb-vocab-stat--total   .eb-vocab-stat-num { color: var(--eb-text); }
.eb-vocab-stat--due     .eb-vocab-stat-num { color: var(--eb-accent); }
.eb-vocab-stat--learned .eb-vocab-stat-num { color: var(--eb-green); }

.eb-vocab-actions {
    margin: 14px 20px 0;
    display: flex;
    gap: 10px;
}
.eb-vocab-action-btn {
    flex: 1;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 14px;
    cursor: pointer;
    font-family: var(--eb-font);
    font-size: 14.5px;
    font-weight: 620;
    letter-spacing: -0.1px;
    transition: var(--eb-press);
}
.eb-vocab-action-btn:active:not(:disabled) { transform: scale(0.985); }
.eb-vocab-action-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.eb-vocab-action-btn--primary {
    background: var(--eb-cta-grad-b);
    box-shadow: var(--eb-shadow-cta-sm);
    color: #fff;
}
.eb-vocab-action-btn--secondary {
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    color: var(--eb-text-mid);
}
.eb-vocab-action-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 22px;
    height: 20px;
    padding: 0 6px;
    border-radius: var(--eb-r-pill);
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}
.eb-vocab-action-btn--primary   .eb-vocab-action-badge { background: rgba(255, 255, 255, 0.22); color: #fff; }
.eb-vocab-action-btn--secondary .eb-vocab-action-badge { background: rgba(255, 255, 255, 0.06); color: var(--eb-text); }

.eb-vocab-search {
    margin: 14px 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    height: 44px;
    padding: 0 14px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    border-radius: var(--eb-r-pill);
}
.eb-vocab-search svg { width: 16px; height: 16px; color: var(--eb-text-dim); flex-shrink: 0; }
.eb-vocab-search input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 16px;
    font-weight: 500;
    min-width: 0;
}
.eb-vocab-search input::placeholder { color: var(--eb-text-dim); }
.eb-vocab-search:focus-within {
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
}

.eb-vocab-list {
    margin: 16px 20px calc(28px + env(safe-area-inset-bottom));
    background: var(--eb-card-grad);
    border-radius: var(--eb-r-card);
    box-shadow: var(--eb-shadow-card);
    overflow: hidden;
}
.eb-vocab-list:empty { display: none; }

.eb-vocab-row {
    padding: 14px 16px;
    display: grid;
    grid-template-columns: 32px 1fr 12px;
    align-items: start;
    column-gap: 12px;
    row-gap: 0;
    background: transparent;
    border: 0;
    text-align: left;
    cursor: pointer;
    font-family: var(--eb-font);
    color: var(--eb-text);
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.eb-vocab-row + .eb-vocab-row { border-top: 1px solid var(--eb-border); }
.eb-vocab-row:active { background: rgba(255, 255, 255, 0.02); }
.eb-vocab-row:focus-visible {
    outline: 2px solid var(--eb-accent);
    outline-offset: -2px;
}

.eb-vocab-ring {
    width: 24px;
    height: 24px;
    justify-self: center;
    margin-top: 2px;
    grid-row: 1;
}
.eb-vocab-row-text { grid-row: 1; min-width: 0; }
.eb-vocab-row-head {
    display: flex;
    align-items: baseline;
    gap: 6px;
    flex-wrap: wrap;
}
.eb-vocab-word {
    font-size: 15px;
    font-weight: 620;
    letter-spacing: -0.15px;
    color: var(--eb-text);
    overflow-wrap: anywhere;
    min-width: 0;
}
.eb-vocab-pos {
    font-size: 13px;
    font-style: italic;
    color: var(--eb-text-dim);
}
.eb-vocab-due-chip {
    padding: 2px 7px;
    border-radius: var(--eb-r-pill);
    background: var(--eb-accent-dim);
    color: #7FB1FF;
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.eb-vocab-translation {
    font-size: 12.5px;
    color: var(--eb-text-dim);
    margin-top: 3px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.eb-vocab-chevron {
    grid-row: 1;
    align-self: center;
    color: var(--eb-text-faint);
    transition: transform 0.2s var(--eb-in);
}
.eb-vocab-row.expanded .eb-vocab-chevron { transform: rotate(90deg); }

.eb-vocab-expanded {
    grid-column: 2 / -1;
    grid-row: 2;
    margin-top: 10px;
    padding: 10px 0 2px;
    border-top: 1px dashed var(--eb-border);
    display: none;
    flex-direction: column;
    gap: 10px;
    animation: slideReveal 0.24s var(--eb-in);
}
.eb-vocab-row.expanded .eb-vocab-expanded { display: flex; }
.eb-vocab-expanded-group[hidden] { display: none; }
.eb-vocab-expanded-eyebrow {
    font-size: 11px;
    font-weight: 620;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--eb-text-dim);
}
.eb-vocab-example {
    margin: 4px 0 0;
    font-size: 14px;
    line-height: 1.5;
    font-style: italic;
    color: var(--eb-text);
}
.eb-vocab-example-tr {
    margin: 2px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--eb-text-dim);
}
.eb-vocab-notes {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--eb-text-mid);
}

.eb-vocab-delete {
    align-self: flex-end;
    padding: 7px 14px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 107, 168, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 107, 168, 0.30);
    color: var(--eb-pink);
    font-family: var(--eb-font);
    font-size: 12.5px;
    font-weight: 620;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: var(--eb-press);
}
.eb-vocab-delete:active { transform: scale(0.96); }

.eb-vocab-skeleton-row {
    height: 56px;
    border-top: 1px solid var(--eb-border);
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.02),
        rgba(255, 255, 255, 0.05),
        rgba(255, 255, 255, 0.02));
    background-size: 200% 100%;
    animation: vocabShimmer 1.4s linear infinite;
}
.eb-vocab-skeleton-row:first-child { border-top: 0; }
@keyframes vocabShimmer {
    from { background-position: 200% 0; }
    to   { background-position: -200% 0; }
}

/* ══════════════════════════════════════════════════════════════════════════
   Vocab Add screen + shared form/CTA/preview primitives
   (eb-input-pill*, eb-cta-primary*, eb-form-*, eb-preview-card*,
   eb-loading-text — consumed cross-screen; eb-vocab-add-nav / -title /
   -tabs / -tab / -tab-icon are Vocab-Add-screen-specific)
   ══════════════════════════════════════════════════════════════════════════ */
#view-vocab-add { padding: 0; }

.eb-vocab-add-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(56px + env(safe-area-inset-top)) 20px 14px;
}
.eb-vocab-add-title {
    flex: 1;
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    letter-spacing: -0.5px;
    color: var(--eb-text);
}

.eb-vocab-add-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    margin: 6px 20px 0;
    padding: 4px;
    border-radius: 14px;
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
}
.eb-vocab-add-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 0;
    background: transparent;
    color: var(--eb-text-dim);
    font-family: var(--eb-font);
    font-size: 13.5px;
    font-weight: 640;
    letter-spacing: -0.1px;
    padding: 10px 8px;
    border-radius: 10px;
    cursor: pointer;
    transition: var(--eb-press), background 0.18s, color 0.18s, box-shadow 0.18s;
}
.eb-vocab-add-tab:active { transform: scale(0.985); }
.eb-vocab-add-tab.active {
    background: rgba(47, 134, 255, 0.12);
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
    color: var(--eb-accent);
}
.eb-vocab-add-tab-icon { font-size: 14px; line-height: 1; }

.eb-form-hint {
    margin: 18px 24px 10px;
    font-size: 13px;
    color: var(--eb-text-dim);
    line-height: 1.4;
}

.eb-input-pill {
    margin: 0 20px;
    display: flex;
    align-items: center;
    padding: 12px 14px;
    border-radius: var(--eb-r-card);
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    transition: box-shadow 0.15s ease;
}
.eb-input-pill:focus-within {
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
}
.eb-input-pill--area { align-items: flex-start; }
.eb-input-pill-field {
    flex: 1;
    background: transparent;
    border: 0;
    outline: none;
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 16px;
    font-weight: 400;
    padding: 0;
    margin: 0;
    min-width: 0;
    box-shadow: none;
    border-radius: 0;
    transition: none;
}
.eb-input-pill-field::placeholder { color: var(--eb-text-faint); }
.eb-input-pill-field--area {
    resize: vertical;
    min-height: 44px;
    line-height: 1.4;
}

.eb-cta-primary {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: calc(100% - 40px);
    margin: 12px 20px 0;
    padding: 14px 16px;
    border: 0;
    border-radius: var(--eb-r-card);
    background: var(--eb-cta-grad);
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 14.5px;
    font-weight: 680;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: var(--eb-press), opacity 0.18s, background 0.18s, box-shadow 0.18s;
    -webkit-tap-highlight-color: transparent;
}
.eb-cta-primary:active { transform: scale(0.985); }
.eb-cta-primary[disabled] {
    cursor: not-allowed;
    opacity: 0.45;
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    color: var(--eb-text-dim);
}
.eb-cta-primary-icon { font-size: 14px; line-height: 1; }

.eb-loading-text {
    margin: 12px 24px 0;
    font-size: 13px;
    color: var(--eb-text-dim);
    font-style: italic;
}

.eb-form-field {
    margin: 14px 20px 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.eb-form-field > .eb-input-pill { margin: 0; }
.eb-form-label {
    font-size: 12px;
    font-weight: 620;
    letter-spacing: 0.2px;
    color: var(--eb-text-dim);
    padding-left: 2px;
}
.eb-form-required { color: var(--eb-pink); margin-left: 2px; }

.eb-preview-card {
    margin: 18px 20px 0;
    padding: 18px 18px;
    border-radius: 18px;
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    animation: cardEnter 0.24s var(--eb-in);
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.eb-preview-card-top {
    display: flex;
    align-items: center;
    gap: 8px;
}
.eb-preview-card-top:empty { display: none; }
.eb-preview-card-word {
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    letter-spacing: -0.4px;
    line-height: 1.2;
    color: var(--eb-text);
}
.eb-preview-card-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.eb-preview-card-translation {
    margin: 0;
    font-size: 15px;
    color: var(--eb-text-mid);
    line-height: 1.4;
}
.eb-preview-card-saved {
    margin: 4px 0 0;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(34, 197, 139, 0.10);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 139, 0.28);
    color: var(--eb-green);
    font-size: 13px;
    font-weight: 640;
}

/* ══════════════════════════════════════════════════════════════════════════
   Knowledge Base
   ══════════════════════════════════════════════════════════════════════════ */
#view-knowledge-base { padding: 0; }

.eb-kb-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(56px + env(safe-area-inset-top)) 20px 14px;
}
.eb-kb-title {
    flex: 1;
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    letter-spacing: -0.5px;
    color: var(--eb-text);
}

.eb-kb-intro {
    margin: 4px 20px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--eb-r-card);
    background: rgba(47, 134, 255, 0.06);
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
    color: var(--eb-text-mid);
    font-size: 13.5px;
    line-height: 1.4;
}
.eb-kb-intro[hidden] { display: none; }
.eb-kb-intro-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
}

.eb-kb-eyebrow {
    margin: 18px 24px 10px;
    font-size: 11px;
    font-weight: 620;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    color: var(--eb-text-dim);
}
.eb-kb-eyebrow[hidden] { display: none; }

.eb-kb-list {
    margin: 0 20px calc(28px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.eb-kb-list:empty { display: none; }

.eb-kb-card {
    position: relative;
    padding: 16px 18px 16px 22px;
    border-radius: 18px;
    background: var(--eb-card-grad);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    cursor: pointer;
    overflow: hidden;
    animation: cardEnter 0.24s var(--eb-in);
    transition: background 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.eb-kb-card::before {
    content: "";
    position: absolute;
    top: 14px;
    bottom: 14px;
    left: 0;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: linear-gradient(180deg, var(--eb-accent), #7C5CFF);
}
.eb-kb-card:active { background: rgba(255, 255, 255, 0.02); }
.eb-kb-card:focus-visible {
    outline: 2px solid var(--eb-accent);
    outline-offset: 2px;
}

.eb-kb-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.eb-kb-tag {
    padding: 3px 9px;
    border-radius: var(--eb-r-pill);
    background: var(--eb-accent-soft);
    box-shadow: inset 0 0 0 1px var(--eb-border-accent);
    color: #7FB1FF;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}
.eb-kb-tag[hidden] { display: none; }
.eb-kb-date {
    font-size: 12px;
    color: var(--eb-text-faint);
    font-weight: 500;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.eb-kb-card-title {
    margin: 10px 0 0;
    font-size: 17px;
    font-weight: 640;
    letter-spacing: -0.3px;
    color: var(--eb-text);
}

.eb-kb-card-preview {
    margin: 6px 0 0;
    font-size: 13px;
    line-height: 1.5;
    color: var(--eb-text-mid);
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
}
.eb-kb-card.expanded .eb-kb-card-preview {
    display: block;
    overflow: visible;
    -webkit-line-clamp: unset;
}

.eb-kb-card-expanded {
    display: none;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px dashed var(--eb-border);
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    animation: slideReveal 0.24s var(--eb-in);
}
.eb-kb-card.expanded .eb-kb-card-expanded { display: flex; }
.eb-kb-card-more-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    flex: 1;
}
.eb-kb-card-more-tags[hidden] { display: none; }
.eb-kb-tag-small {
    padding: 2px 8px;
    border-radius: var(--eb-r-pill);
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    color: var(--eb-text-mid);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.eb-kb-delete {
    padding: 7px 14px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 107, 168, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 107, 168, 0.30);
    color: var(--eb-pink);
    font-family: var(--eb-font);
    font-size: 12.5px;
    font-weight: 620;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: var(--eb-press);
    flex-shrink: 0;
}
.eb-kb-delete:active { transform: scale(0.96); }

/* ══════════════════════════════════════════════════════════════════════════
   Word popup (bottom sheet)
   ══════════════════════════════════════════════════════════════════════════ */
.eb-word-popup-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 200;
    animation: fadeIn 0.18s ease-out;
}
.eb-word-popup-overlay.hidden,
.eb-word-popup.hidden { display: none; }

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

.eb-word-popup {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 201;
    padding: 10px 20px calc(28px + env(safe-area-inset-bottom));
    border-radius: 24px 24px 0 0;
    background: var(--eb-bg-elev);
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    animation: wordPopupSlideUp 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
    max-height: 82dvh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
@keyframes wordPopupSlideUp {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}

.eb-word-popup-handle {
    align-self: center;
    width: 40px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.2);
    margin: 4px 0 4px;
}

.eb-word-popup-loading {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 8px 0;
}
.eb-word-popup-skeleton-title,
.eb-word-popup-skeleton-row {
    border-radius: 10px;
    background: linear-gradient(90deg,
        rgba(255, 255, 255, 0.04) 0%,
        rgba(255, 255, 255, 0.08) 50%,
        rgba(255, 255, 255, 0.04) 100%);
    background-size: 200% 100%;
    animation: vocabShimmer 1.4s linear infinite;
}
.eb-word-popup-skeleton-title { height: 28px; width: 60%; }
.eb-word-popup-skeleton-row   { height: 14px; width: 100%; }
.eb-word-popup-skeleton-row--short { width: 60%; }

.eb-word-popup-content { display: flex; flex-direction: column; gap: 14px; }
.eb-word-popup-content.hidden { display: none; }

.eb-word-popup-top {
    display: flex;
    align-items: center;
    gap: 8px;
}

.eb-word-popup-word {
    margin: 0;
    font-size: 22px;
    font-weight: 720;
    letter-spacing: -0.4px;
    line-height: 1.2;
    color: var(--eb-text);
}
.eb-word-popup-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.eb-word-popup-group[hidden] { display: none; }
.eb-word-popup-translation {
    margin: 0;
    font-size: 15px;
    color: var(--eb-text-mid);
    line-height: 1.4;
}

.eb-word-popup-actions {
    display: flex;
    gap: 8px;
    margin-top: 6px;
}
.eb-word-popup-save {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 14px;
    border: 0;
    border-radius: 12px;
    background: var(--eb-cta-grad);
    color: var(--eb-text);
    font-family: var(--eb-font);
    font-size: 13.5px;
    font-weight: 680;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: var(--eb-press);
    -webkit-tap-highlight-color: transparent;
}
.eb-word-popup-save:active { transform: scale(0.97); }
.eb-word-popup-save-icon { font-size: 13px; line-height: 1; }
.eb-word-popup-copy {
    flex: 1;
    padding: 12px 14px;
    border: 0;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.05);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    color: var(--eb-text-mid);
    font-family: var(--eb-font);
    font-size: 13.5px;
    font-weight: 620;
    letter-spacing: -0.1px;
    cursor: pointer;
    transition: var(--eb-press);
    -webkit-tap-highlight-color: transparent;
}
.eb-word-popup-copy:active { transform: scale(0.97); }

.eb-word-popup-saved {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(34, 197, 139, 0.10);
    box-shadow: inset 0 0 0 1px rgba(34, 197, 139, 0.28);
    color: var(--eb-green);
    font-size: 13px;
    font-weight: 640;
}
.eb-word-popup-saved.hidden { display: none; }

/* ══════════════════════════════════════════════════════════════════════════
   Reduced motion
   ══════════════════════════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* iOS PWA safe-area insets (notch / home indicator) */
.view-header {
    padding-top: calc(16px + env(safe-area-inset-top));
}
body {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
}

/* ══════════════════════════════════════════════════════════════════════════
   Lucide icon sizing — Lucide's createIcons() turns <i data-lucide="..."> into
   <svg class="lucide lucide-...">. These rules size the generated SVGs so each
   consumer gets crisp, monochromatic glyphs coloured via currentColor.
   Note: we hide the pre-hydration <i> to avoid a flash of the raw attribute.
   ══════════════════════════════════════════════════════════════════════════ */
[data-lucide] { display: inline-flex; }
[data-lucide]:not(svg) { width: 0; height: 0; overflow: hidden; }

/* Home row icon — tinted square with coloured glyph */
.home-focus-row-icon .lucide,
.home-focus-row-icon svg.lucide {
    width: 20px; height: 20px;
    stroke-width: 2;
    color: var(--dot);
}

/* Home row chevron — replaces old inline SVG */
.home-focus-row-chevron.lucide,
svg.home-focus-row-chevron {
    width: 16px; height: 16px;
    stroke-width: 2;
    color: var(--eb-text-faint);
    flex-shrink: 0;
}

/* Streak chip — flame glyph inherits streak colour */
.home-focus-streak-chip .lucide {
    width: 14px; height: 14px;
    stroke-width: 2.2;
    color: var(--eb-streak);
}

/* Dialog-Topic card icon — tinted glyph in neutral square */
.eb-dialog-topic-card-icon .lucide {
    width: 22px; height: 22px;
    stroke-width: 2;
    color: var(--dot, var(--eb-text-mid));
}

/* Primary CTA inline icon (Generate / Save word / Add to vocab) */
.eb-cta-primary-icon.lucide,
svg.eb-cta-primary-icon {
    width: 18px; height: 18px;
    stroke-width: 2.2;
    color: #fff;
    flex-shrink: 0;
}

/* Vocab-Add AI tab icon */
.eb-vocab-add-tab-icon.lucide,
svg.eb-vocab-add-tab-icon {
    width: 14px; height: 14px;
    stroke-width: 2.2;
    flex-shrink: 0;
}

/* Knowledge-Base intro banner icon */
.eb-kb-intro-icon.lucide,
svg.eb-kb-intro-icon {
    width: 18px; height: 18px;
    stroke-width: 2;
    color: var(--eb-orange);
    flex-shrink: 0;
}

/* Word popup "Add to Vocabulary" button icon */
.eb-word-popup-save-icon.lucide,
svg.eb-word-popup-save-icon {
    width: 16px; height: 16px;
    stroke-width: 2.2;
    color: #fff;
    flex-shrink: 0;
}

/* Empty-state icon — was font-size:56px for an emoji. Now a centred SVG
   inside a circular tinted chip for visual weight parity with the design. */
.eb-empty-icon {
    width: 72px; height: 72px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 0 0 1px var(--eb-border);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
}
.eb-empty-icon .lucide {
    width: 32px; height: 32px;
    stroke-width: 1.8;
    color: var(--eb-text-mid);
}

/* Preview-card & word-popup "Saved!" checkmark */
.eb-preview-card-saved .lucide,
.eb-word-popup-saved .lucide {
    width: 14px; height: 14px;
    stroke-width: 2.4;
    color: var(--eb-green);
}
