/* ============================================================
   Peeky Web Reader — reader.css
   Design system variables match index.html (Peeky landing page).
   ============================================================ */

/* ── CSS Variables ──────────────────────────────────────────── */
:root {
    --bg:     #0A0E1A;
    --bg2:    #0F1525;
    --bg3:    #141929;
    --cyan:   #00E5FF;
    --purple: #7B61FF;
    --white:  #F0F4FF;
    --muted:  #8892A4;
    --border: rgba(255, 255, 255, 0.07);
    --success:#10B981;
    --error:  #FF6B6B;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-xl: 24px;

    --font-heading: 'Space Grotesk', sans-serif;
    --font-body:    'Inter', sans-serif;
}

/* ── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--white);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
}
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--font-body); cursor: pointer; border: none; background: none; }
img { max-width: 100%; }

/* ── Layout Container ───────────────────────────────────────── */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* ── NAVBAR ─────────────────────────────────────────────────── */
.reader-nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    height: 60px;
    display: flex;
    align-items: center;
}
.reader-nav .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}
.nav-logo {
    display: inline-flex;
    align-items: center;
    gap: 0.28rem;
    text-decoration: none;
    flex-shrink: 0;
    line-height: 1;
}
.nav-links-row {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}
.nav-link {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
    transition: color 0.2s;
    white-space: nowrap;
}
.nav-link:hover { color: var(--cyan); text-decoration: none; }
.nav-link.active { color: var(--cyan); }
.nav-auth-area {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.btn-nav-login {
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 500;
    padding: 0.4rem 0.75rem;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}
.btn-nav-login:hover { color: var(--white); }
.btn-nav-signup {
    background: var(--cyan);
    color: var(--bg);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.4rem 1rem;
    border-radius: var(--radius-sm);
    transition: box-shadow 0.2s, transform 0.2s;
}
.btn-nav-signup:hover {
    box-shadow: 0 0 16px rgba(0, 229, 255, 0.35);
    transform: translateY(-1px);
}
.nav-user-chip {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.nav-user-chip strong { color: var(--white); font-weight: 600; }
.btn-signout {
    color: var(--muted);
    font-size: 0.8rem;
    padding: 0.3rem 0.6rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color 0.2s, color 0.2s;
}
.btn-signout:hover { border-color: var(--muted); color: var(--white); }

/* ── URL INPUT SECTION ──────────────────────────────────────── */
.url-section {
    padding: 3rem 0 2.5rem;
    text-align: center;
    min-height: calc(100vh - 60px);
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.url-section .container {
    width: 100%;
}
.url-section-title {
    font-family: var(--font-heading);
    font-size: clamp(1.55rem, 4.2vw, 2.45rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: 0.55rem;
    background: linear-gradient(135deg, var(--white) 0%, var(--cyan) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.url-section-sub {
    color: var(--muted);
    font-size: clamp(0.92rem, 2vw, 1.05rem);
    margin-bottom: 2.25rem;
    max-width: 540px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.55;
}
.url-form {
    display: flex;
    gap: 0.75rem;
    max-width: 680px;
    margin: 0 auto 1.25rem;
}
.url-input {
    flex: 1;
    background: var(--bg2);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.85rem 1.1rem;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.url-input::placeholder { color: var(--muted); }
.url-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12);
}
.btn-fetch {
    background: var(--cyan);
    color: var(--bg);
    font-size: 0.95rem;
    font-weight: 700;
    padding: 0.85rem 1.5rem;
    border-radius: var(--radius-md);
    white-space: nowrap;
    transition: box-shadow 0.2s, transform 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}
.btn-fetch:hover:not(:disabled) {
    box-shadow: 0 0 22px rgba(0, 229, 255, 0.35);
    transform: translateY(-1px);
}
.btn-fetch:disabled { opacity: 0.6; cursor: not-allowed; }
.example-links {
    font-size: 0.85rem;
    color: var(--muted);
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
    justify-content: center;
}
.example-links span { flex-shrink: 0; }
.example-link {
    color: var(--cyan);
    background: rgba(0, 229, 255, 0.08);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 999px;
    padding: 0.2rem 0.75rem;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
}
.example-link:hover {
    background: rgba(0, 229, 255, 0.15);
    border-color: var(--cyan);
}

/* ── READER MODE HUB (URL / Clipboard / Upload) ─────────────── */
.reader-mode-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    max-width: 820px;
    margin: 0 auto;
}
.reader-mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    text-align: center;
    text-decoration: none !important;
    background: linear-gradient(180deg, rgba(20, 25, 41, 0.95) 0%, rgba(15, 21, 37, 0.98) 100%);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.85rem 1.15rem 1.55rem;
    color: var(--white);
    transition: border-color 0.22s, transform 0.22s, box-shadow 0.22s, background 0.22s;
    min-height: 190px;
    justify-content: center;
}
.reader-mode-card:hover {
    border-color: rgba(0, 229, 255, 0.5);
    background: linear-gradient(180deg, rgba(0, 229, 255, 0.08) 0%, rgba(15, 21, 37, 0.98) 100%);
    transform: translateY(-4px);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(0, 229, 255, 0.08);
}
.reader-mode-card:active {
    transform: translateY(-1px);
}
.reader-mode-card:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
}
.reader-mode-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 68px;
    height: 68px;
    border-radius: 18px;
    background: rgba(0, 229, 255, 0.1);
    color: var(--cyan);
    margin-bottom: 0.35rem;
    transition: transform 0.22s;
}
.reader-mode-card:hover .reader-mode-icon {
    transform: scale(1.06);
}
.reader-mode-card:nth-child(2) .reader-mode-icon {
    background: rgba(123, 97, 255, 0.12);
    color: var(--purple);
}
.reader-mode-card:nth-child(2):hover {
    border-color: rgba(123, 97, 255, 0.5);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(123, 97, 255, 0.1);
}
.reader-mode-card:nth-child(3) .reader-mode-icon {
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
}
.reader-mode-card:nth-child(3):hover {
    border-color: rgba(16, 185, 129, 0.5);
    box-shadow: 0 14px 36px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(16, 185, 129, 0.1);
}
.reader-mode-label {
    font-family: var(--font-heading);
    font-size: 1.2rem;
    font-weight: 800;
    letter-spacing: -0.02em;
}
.reader-mode-desc {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.4;
    max-width: 14ch;
}

/* Mode switcher on functional pages */
.reader-mode-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1.75rem;
}
.reader-back-link {
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 500;
    text-decoration: none;
    padding: 0.2rem 0.4rem;
}
.reader-back-link:hover { color: var(--cyan); text-decoration: none; }
.reader-mode-pills {
    display: inline-flex;
    gap: 0.3rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.3rem;
    max-width: 100%;
}
.reader-mode-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--muted);
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0.55rem 1rem;
    border-radius: 999px;
    text-decoration: none !important;
    transition: color 0.2s, background 0.2s, box-shadow 0.2s;
}
.reader-mode-pill:hover { color: var(--white); background: rgba(255,255,255,0.04); }
.reader-mode-pill.active {
    color: var(--bg);
    background: var(--cyan);
    box-shadow: 0 2px 14px rgba(0, 229, 255, 0.3);
}
.reader-mode-pill.active svg { stroke: var(--bg); }

/* Functional page panels */
.input-tabs {
    display: none;
}
.input-panel {
    max-width: 680px;
    margin: 0 auto;
    text-align: left;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.35rem 1.35rem 1.4rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}
.input-panel[hidden] { display: none !important; }
#panel-url .url-form {
    margin-bottom: 1rem;
    max-width: none;
}
#panel-url .url-input {
    background: var(--bg);
}
#panel-url .example-links {
    justify-content: flex-start;
    margin-top: 0.25rem;
}

/* Paste text panel */
.paste-form {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.paste-title-input {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.75rem 1rem;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}
.paste-title-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12);
}
.paste-text-input {
    background: var(--bg);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 1rem 1.1rem;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.65;
    resize: vertical;
    min-height: 200px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    width: 100%;
}
.paste-text-input::placeholder,
.paste-title-input::placeholder { color: var(--muted); }
.paste-text-input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.12);
}
.paste-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.paste-meta span {
    color: var(--muted);
    font-size: 0.82rem;
}

/* File upload panel */
.upload-dropzone {
    position: relative;
    background: var(--bg);
    border: 2px dashed rgba(0, 229, 255, 0.28);
    border-radius: var(--radius-lg);
    padding: 2.4rem 1.4rem;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    margin-bottom: 1rem;
}
.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--cyan);
    background: rgba(0, 229, 255, 0.05);
}
.file-input-hidden {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
}
.upload-dropzone-icon {
    font-size: 2.4rem;
    margin-bottom: 0.45rem;
}
.upload-dropzone-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
}
.upload-dropzone-hint {
    color: var(--muted);
    font-size: 0.85rem;
}
.upload-file-name {
    margin-top: 0.75rem;
    color: var(--cyan);
    font-size: 0.88rem;
    font-weight: 500;
    word-break: break-all;
}
.upload-submit-btn {
    width: 100%;
    justify-content: center;
}

.article-new-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: 100%;
    margin-top: 0.65rem;
    padding: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    text-decoration: none !important;
    transition: color 0.2s, border-color 0.2s;
}
.article-new-btn:hover {
    color: var(--cyan);
    border-color: rgba(0, 229, 255, 0.35);
}

/* ── SKELETON LOADER ────────────────────────────────────────── */
.skeleton-wrap {
    max-width: 720px;
    margin: 2rem auto;
    padding: 0 1.5rem;
    display: none;
}
.skeleton-wrap.visible { display: block; }
.skeleton-label {
    color: var(--muted);
    font-size: 0.85rem;
    text-align: center;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.skeleton-label::before {
    content: '';
    display: inline-block;
    width: 10px;
    height: 10px;
    border: 2px solid var(--cyan);
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.skeleton-line {
    background: linear-gradient(90deg, var(--bg2) 25%, var(--bg3) 50%, var(--bg2) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
}
@keyframes shimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}
.skeleton-title  { height: 36px; width: 60%; margin-bottom: 1rem; }
.skeleton-meta   { height: 20px; width: 40%; margin-bottom: 2rem; }
.skeleton-p      { height: 16px; }
.skeleton-p.short{ width: 70%; }

/* ── ERROR BANNER ───────────────────────────────────────────── */
.error-banner {
    max-width: 680px;
    margin: 1.5rem auto;
    background: rgba(255, 107, 107, 0.1);
    border: 1px solid rgba(255, 107, 107, 0.3);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    display: none;
    align-items: center;
    gap: 0.75rem;
    color: var(--error);
    font-size: 0.9rem;
}
.error-banner.visible { display: flex; }
.error-banner-icon { font-size: 1.1rem; flex-shrink: 0; }

/* ── ARTICLE VIEW ───────────────────────────────────────────── */
.article-wrap {
    display: none;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem 4rem;
    gap: 2.5rem;
}
.article-wrap.visible {
    display: flex;
    align-items: flex-start;
}

/* Main article column */
.article-main {
    flex: 1;
    min-width: 0;
    max-width: 720px;
}
.article-header { margin-bottom: 1.5rem; }
.article-title {
    font-family: var(--font-heading);
    font-size: clamp(1.5rem, 3.5vw, 2.1rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--white);
    line-height: 1.25;
    margin-bottom: 0.75rem;
}
.article-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.85rem;
    color: var(--muted);
}
.article-source-badge {
    background: rgba(0, 229, 255, 0.1);
    color: var(--cyan);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 999px;
    padding: 0.2rem 0.7rem;
    font-weight: 600;
    font-size: 0.8rem;
}
.article-meta-sep { color: var(--border); }
.article-divider {
    height: 1px;
    background: var(--border);
    margin: 1.25rem 0;
}

/* Article body typography */
.article-body {
    font-size: 1.1rem;
    line-height: 1.85;
    color: var(--white);
}
.article-body p {
    margin-bottom: 1.4rem;
    color: #d4dae8;
}
.article-body h1,
.article-body h2 {
    font-family: var(--font-heading);
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--white);
    margin: 1.75rem 0 0.75rem;
}
.article-body h3,
.article-body h4 {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--white);
    margin: 1.5rem 0 0.5rem;
}
.article-body blockquote {
    border-left: 3px solid var(--cyan);
    margin: 1.25rem 0;
    padding: 0.5rem 1.25rem;
    color: var(--muted);
    font-style: italic;
}
.article-body li {
    margin-bottom: 0.4rem;
    padding-left: 0.5rem;
}
.article-body a {
    color: var(--cyan);
    text-decoration: underline;
    text-decoration-color: rgba(0, 229, 255, 0.4);
}
.article-body a:hover { text-decoration-color: var(--cyan); }

/* Article footer (quiz CTA) */
.article-footer-cta {
    margin-top: 2.5rem;
    padding: 1.5rem;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    text-align: center;
}
.article-footer-cta p {
    color: var(--muted);
    margin-bottom: 0.75rem;
    font-size: 0.95rem;
}
.btn-quiz {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--purple);
    color: var(--white);
    font-weight: 700;
    font-size: 0.9rem;
    padding: 0.65rem 1.25rem;
    border-radius: var(--radius-md);
    transition: box-shadow 0.2s, transform 0.2s;
}
.btn-quiz:hover {
    box-shadow: 0 0 18px rgba(123, 97, 255, 0.4);
    transform: translateY(-1px);
    text-decoration: none;
    color: var(--white);
}

/* ── STICKY SIDEBAR (desktop only) ──────────────────────────── */
.article-sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 80px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    display: none; /* hidden until article loads */
}
@media (min-width: 900px) {
    .article-sidebar { display: block; }
}
.sidebar-title {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
    margin-bottom: 1rem;
}
.sidebar-stat {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
    font-size: 0.88rem;
}
.sidebar-stat-value {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--cyan);
    line-height: 1;
}
.sidebar-stat-label { color: var(--muted); font-size: 0.8rem; }
.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 1rem 0;
}
.sidebar-tip {
    font-size: 0.78rem;
    color: var(--muted);
    line-height: 1.5;
}
.sidebar-tip strong { color: var(--white); }

/* ── PEEKY WORD HIGHLIGHTING ─────────────────────────────────── */
.peeky-word {
    color: inherit;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    border-radius: 2px;
    position: relative;
}
/* Subtle underline for ordinary interactive words */
.peeky-word--normal {
    border-bottom: 1px dotted rgba(0, 229, 255, 0.28);
}
/* Strong underline for curated difficult / academic words */
.peeky-word--difficult {
    border-bottom: 2px solid rgba(0, 229, 255, 0.6);
}
.peeky-word--selected {
    border-bottom: 2px solid rgba(123, 97, 255, 0.7);
    background: rgba(123, 97, 255, 0.08);
}
.peeky-word:hover,
.peeky-word.active {
    background: rgba(0, 229, 255, 0.1);
}
.peeky-word--difficult:hover,
.peeky-word--difficult.active {
    border-bottom-color: var(--cyan);
}
.peeky-word--normal:hover,
.peeky-word--normal.active {
    border-bottom-color: rgba(0, 229, 255, 0.55);
    border-bottom-style: solid;
}

/* ── TOOLTIP ─────────────────────────────────────────────────── */
#peeky-tooltip {
    position: fixed;
    z-index: 9999;
    width: 300px;
    background: #141929;
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: var(--radius-lg);
    padding: 1.1rem;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(0, 229, 255, 0.08);
    pointer-events: auto;
    display: none;
    opacity: 0;
    transform: translateY(6px) scale(0.97);
    transition: opacity 0.18s ease, transform 0.18s ease;
}
#peeky-tooltip.visible {
    display: block;
    opacity: 1;
    transform: translateY(0) scale(1);
}
/* caret arrow */
#peeky-tooltip::after {
    content: '';
    position: absolute;
    width: 10px;
    height: 10px;
    background: #141929;
    border-left: 1px solid rgba(0, 229, 255, 0.25);
    border-bottom: 1px solid rgba(0, 229, 255, 0.25);
    transform: rotate(-45deg);
    bottom: -6px;
    left: 50%;
    margin-left: -5px;
}
#peeky-tooltip.above::after {
    bottom: -6px;
    top: auto;
    transform: rotate(-45deg);
}
#peeky-tooltip.below::after {
    top: -6px;
    bottom: auto;
    transform: rotate(135deg);
}

.pt-close {
    position: absolute;
    top: 0.6rem;
    right: 0.7rem;
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 1rem;
    border-radius: 4px;
    transition: color 0.15s, background 0.15s;
}
.pt-close:hover { color: var(--white); background: rgba(255,255,255,0.08); }

.pt-header { margin-bottom: 0.6rem; }
.pt-word-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
    padding-right: 1.5rem; /* avoid overlap with close btn */
}
.pt-word {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--white);
}
.pt-pos {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--purple);
    color: #fff;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    flex-shrink: 0;
}

/* Confidence colored dot */
.pt-confidence {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
    display: inline-block;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}
.pt-confidence--high { background: #10B981; }
.pt-confidence--mid  { background: #FBBF24; }
.pt-confidence--low  { background: #FF6B6B; }

/* Context-aware badge */
.pt-context-badge {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: var(--success);
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 4px;
    padding: 0.12rem 0.4rem;
    flex-shrink: 0;
    cursor: help;
    white-space: nowrap;
}

.pt-phonetic-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.pt-audio-btn {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    transition: background 0.15s, transform 0.15s;
    flex-shrink: 0;
    min-width: 44px; /* touch target */
    min-height: 44px;
    width: 44px;
    height: 44px;
}
.pt-audio-btn:hover { background: rgba(0, 229, 255, 0.2); transform: scale(1.08); }
.pt-ipa {
    color: var(--muted);
    font-size: 0.85rem;
    font-style: italic;
}

.pt-divider {
    height: 1px;
    background: var(--border);
    margin: 0.6rem 0;
}

.pt-bangla {
    color: var(--cyan);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    line-height: 1.4;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-wrap: wrap;
}
.pt-bangla-empty { color: var(--muted); font-size: 0.85rem; font-style: italic; }

.pt-explanation {
    color: var(--muted);
    font-size: 0.8rem;
    line-height: 1.45;
    margin-bottom: 0.5rem;
}

.pt-definition {
    color: var(--muted);
    font-size: 0.85rem;
    line-height: 1.5;
    margin-bottom: 0.6rem;
}

/* Alternate meanings dropdown */
.pt-alternates {
    margin-bottom: 0.65rem;
}
.pt-alternates-toggle {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--muted);
    padding: 0.2rem 0;
    transition: color 0.15s;
}
.pt-alternates-toggle:hover { color: var(--cyan); }
.pt-alternates-list {
    margin-top: 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.45rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}
.pt-alt-item {
    text-align: left;
    color: var(--white);
    font-size: 0.82rem;
    padding: 0.4rem 0.55rem;
    border-radius: 4px;
    transition: background 0.15s, color 0.15s;
    min-height: 32px;
}
.pt-alt-item:hover {
    background: rgba(0, 229, 255, 0.1);
    color: var(--cyan);
}

/* Better meaning button */
.pt-better-btn {
    width: 100%;
    margin-bottom: 0.55rem;
    background: rgba(251, 191, 36, 0.1);
    color: #FBBF24;
    border: 1px solid rgba(251, 191, 36, 0.3);
    border-radius: var(--radius-sm);
    padding: 0.45rem 0.6rem;
    font-size: 0.8rem;
    font-weight: 600;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    transition: background 0.15s, border-color 0.15s;
}
.pt-better-btn:hover:not(:disabled) {
    background: rgba(251, 191, 36, 0.18);
    border-color: #FBBF24;
}
.pt-better-btn:disabled { opacity: 0.7; cursor: default; }

.pt-loading-spinner--inline {
    width: 12px;
    height: 12px;
    border-width: 2px;
    display: inline-block;
    vertical-align: middle;
    flex-shrink: 0;
}

.pt-synonyms {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.75rem;
}
.pt-synonym-chip {
    background: rgba(0, 229, 255, 0.08);
    color: var(--cyan);
    border: 1px solid rgba(0, 229, 255, 0.2);
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-size: 0.8rem;
    font-weight: 500;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    min-height: 32px; /* touch target */
    display: flex;
    align-items: center;
}
.pt-synonym-chip:hover {
    background: rgba(0, 229, 255, 0.18);
    border-color: var(--cyan);
    transform: translateY(-1px);
}

.pt-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.pt-save-btn {
    flex: 1;
    background: rgba(0, 229, 255, 0.1);
    color: var(--cyan);
    border: 1px solid rgba(0, 229, 255, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    font-size: 0.82rem;
    font-weight: 600;
    transition: background 0.15s, border-color 0.15s;
    min-height: 40px;
}
.pt-save-btn:hover:not(:disabled) {
    background: rgba(0, 229, 255, 0.2);
    border-color: var(--cyan);
}
.pt-save-btn:disabled { opacity: 0.6; cursor: default; }
.pt-save-btn.saved {
    background: rgba(16, 185, 129, 0.1);
    color: var(--success);
    border-color: rgba(16, 185, 129, 0.3);
}
.pt-signup-prompt {
    font-size: 0.8rem;
    color: var(--muted);
    text-align: center;
}
.pt-signup-prompt a { color: var(--cyan); font-weight: 600; }

/* ── ADVANCED ANALYZER ───────────────────────────────────────── */
.pt-analyze-row { margin-top: 0.5rem; }
.pt-analyze-btn {
    width: 100%;
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.18), rgba(0, 229, 255, 0.12));
    color: var(--white);
    border: 1px solid var(--purple);
    border-radius: var(--radius-sm);
    padding: 0.5rem;
    font-size: 0.82rem;
    font-weight: 700;
    transition: background 0.15s, border-color 0.15s, transform 0.15s;
    min-height: 40px;
}
.pt-analyze-btn:hover:not(:disabled) {
    background: linear-gradient(135deg, rgba(124, 92, 255, 0.32), rgba(0, 229, 255, 0.2));
    transform: translateY(-1px);
}
.pt-analyze-btn:disabled { opacity: 0.65; cursor: default; }

.pt-analysis {
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--border);
    max-height: 260px;
    overflow-y: auto;
}
.pt-analysis-body {
    color: var(--white);
    font-size: 0.82rem;
    line-height: 1.6;
}
.pt-analysis-usage {
    margin-top: 0.5rem;
    font-size: 0.72rem;
    color: var(--muted);
    text-align: right;
}
.pt-analysis-limit {
    color: #FFB86B;
    font-size: 0.8rem;
    line-height: 1.5;
}

.pt-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 0;
    color: var(--muted);
    font-size: 0.85rem;
}
.pt-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--cyan);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

/* ── AUTH MODAL ──────────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 8, 16, 0.75);
    backdrop-filter: blur(6px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}
.modal-overlay.open { display: flex; }
.modal {
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 100%;
    max-width: 400px;
    position: relative;
    box-shadow: 0 32px 80px rgba(0,0,0,0.65);
    animation: fadeUp 0.25s ease-out;
}
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}
.modal-close-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    color: var(--muted);
    font-size: 1.2rem;
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
    transition: color 0.15s;
}
.modal-close-btn:hover { color: var(--white); }
.modal h3 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    font-weight: 800;
    margin-bottom: 0.25rem;
}
.modal-subtitle { color: var(--muted); font-size: 0.88rem; margin-bottom: 1.5rem; }
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--muted);
    margin-bottom: 0.35rem;
}
.form-group input {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.85rem;
    color: var(--white);
    font-family: var(--font-body);
    font-size: 0.93rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    outline: none;
}
.form-group input:focus {
    border-color: var(--cyan);
    box-shadow: 0 0 0 3px rgba(0,229,255,0.1);
}
.modal-error {
    color: var(--error);
    font-size: 0.82rem;
    min-height: 1.2rem;
    margin-bottom: 0.5rem;
}
.btn-modal-submit {
    width: 100%;
    background: var(--cyan);
    color: var(--bg);
    font-weight: 700;
    font-size: 0.95rem;
    padding: 0.75rem;
    border-radius: var(--radius-sm);
    transition: box-shadow 0.2s, opacity 0.2s;
    margin-top: 0.25rem;
}
.btn-modal-submit:hover:not(:disabled) { box-shadow: 0 0 20px rgba(0,229,255,0.3); }
.btn-modal-submit:disabled { opacity: 0.6; cursor: not-allowed; }
.modal-switch {
    margin-top: 1rem;
    font-size: 0.83rem;
    color: var(--muted);
    text-align: center;
}
.modal-switch button {
    color: var(--cyan);
    font-weight: 600;
    font-size: 0.83rem;
    margin-left: 0.25rem;
}
.hidden-field { display: none; }

/* ── TOAST ───────────────────────────────────────────────────── */
#peeky-toast {
    position: fixed;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%) translateY(1rem);
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 0.65rem 1.25rem;
    color: var(--white);
    font-size: 0.88rem;
    z-index: 20000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s, transform 0.25s;
    white-space: nowrap;
    max-width: calc(100vw - 2rem);
}
#peeky-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
#peeky-toast.success { border-color: var(--success); }
#peeky-toast.error   { border-color: var(--error); }

/* ── RESPONSIVE ──────────────────────────────────────────────── */
@media (max-width: 640px) {
    .url-section {
        padding: 1.75rem 0 1.5rem;
        min-height: auto;
        justify-content: flex-start;
    }
    .url-section-sub {
        margin-bottom: 1.5rem;
        padding: 0 0.25rem;
    }
    .reader-mode-grid {
        grid-template-columns: 1fr;
        max-width: 400px;
        gap: 0.7rem;
    }
    .reader-mode-card {
        flex-direction: row;
        text-align: left;
        padding: 1rem 1.1rem;
        gap: 0.85rem;
        min-height: 0;
        justify-content: flex-start;
    }
    .reader-mode-icon {
        width: 50px;
        height: 50px;
        border-radius: 14px;
        margin-bottom: 0;
        flex-shrink: 0;
    }
    .reader-mode-icon svg {
        width: 24px;
        height: 24px;
    }
    .reader-mode-label { font-size: 1.05rem; }
    .reader-mode-desc {
        font-size: 0.78rem;
        max-width: none;
    }
    .reader-mode-pills {
        width: 100%;
        justify-content: stretch;
    }
    .reader-mode-pill {
        flex: 1;
        justify-content: center;
        padding: 0.55rem 0.35rem;
        font-size: 0.75rem;
        gap: 0.25rem;
    }
    .reader-mode-pill span { display: inline; }
    .input-panel {
        padding: 1rem;
        border-radius: var(--radius-lg);
    }
    .url-form {
        flex-direction: column;
        gap: 0.6rem;
    }
    .btn-fetch { width: 100%; justify-content: center; }
    .paste-meta { flex-direction: column; align-items: stretch; }
    .paste-meta .btn-fetch { width: 100%; }
    .btn-fetch { width: 100%; justify-content: center; }
    .paste-meta { flex-direction: column; align-items: stretch; }

    .article-wrap { padding: 0 1rem 3rem; }

    /* Tooltip becomes wider on mobile */
    #peeky-tooltip {
        width: calc(100vw - 2rem);
        max-width: 340px;
        left: 1rem !important;
        right: 1rem;
    }

    .pt-audio-btn { min-width: 44px; min-height: 44px; }
    .pt-synonym-chip { min-height: 36px; }

    .nav-links-row { display: none; }
}

@media (max-width: 900px) {
    .article-sidebar { display: none !important; }
    .article-main { max-width: 100%; }
}
