/* wordwise.css -- styling for the WordWise reading-helper PWA.
   Big, friendly, high-contrast, large tap targets for a young reader on a
   phone. ASCII-only source (the JS escapes any glyphs it needs). */

:root {
    --ww-bg:        #FFF8EC;
    --ww-surface:   #FFFFFF;
    --ww-ink:       #2A2540;
    --ww-muted:     #6E6880;
    --ww-accent:    #5B3FA8;
    --ww-accent-2:  #7C5DD6;
    --ww-hard:      #C2410C;
    --ww-hard-bg:   #FFEDD5;
    --ww-border:    #EAE3F2;
    --ww-shadow:    0 6px 20px rgba(43, 37, 64, 0.14);
}

* { box-sizing: border-box; }

html, body {
    margin: 0; padding: 0;
    min-height: 100dvh;
    background: var(--ww-bg);
    color: var(--ww-ink);
    font-family: "Segoe UI", system-ui, -apple-system, "Comic Sans MS", sans-serif;
    -webkit-text-size-adjust: 100%;
}

/* ---- Header --------------------------------------------------------- */
.ww-header {
    background: linear-gradient(135deg, var(--ww-accent), var(--ww-accent-2));
    color: #fff;
    padding: 18px 18px 16px;
    box-shadow: var(--ww-shadow);
}
.ww-header h1 {
    margin: 0; font-size: 24pt; font-weight: 800; letter-spacing: -0.5px;
}
.ww-header .ww-sub { margin-top: 4px; font-size: 12pt; opacity: 0.92; }

/* ---- Main + paste box ----------------------------------------------- */
.ww-main { max-width: 760px; margin: 0 auto; padding: 18px 16px 140px; }

.ww-paste {
    width: 100%;
    min-height: 120px;
    border: 2px solid var(--ww-border);
    border-radius: 16px;
    padding: 14px 16px;
    font: 14pt "Segoe UI", system-ui, sans-serif;
    color: var(--ww-ink);
    background: var(--ww-surface);
    outline: none;
    resize: vertical;
}
.ww-paste:focus {
    border-color: var(--ww-accent-2);
    box-shadow: 0 0 0 4px rgba(124, 93, 214, 0.18);
}

.ww-actions { display: flex; gap: 12px; margin-top: 12px; }
.ww-btn {
    flex: 1;
    padding: 16px 14px;
    font: 800 14pt "Segoe UI", system-ui, sans-serif;
    border: none; border-radius: 14px;
    cursor: pointer;
    box-shadow: var(--ww-shadow);
}
.ww-btn-go    { background: var(--ww-accent); color: #fff; }
.ww-btn-go:active { transform: scale(0.98); }
.ww-btn-clear { background: var(--ww-surface); color: var(--ww-accent); border: 2px solid var(--ww-border); }

/* ---- Reading area --------------------------------------------------- */
.ww-reading {
    margin-top: 18px;
    background: var(--ww-surface);
    border: 2px solid var(--ww-border);
    border-radius: 16px;
    padding: 20px 20px 24px;
    font-size: 17pt;
    line-height: 1.85;
    box-shadow: var(--ww-shadow);
    word-wrap: break-word;
}
.ww-reading.ww-empty { color: var(--ww-muted); font-size: 13pt; line-height: 1.6; }

/* An underlined, tappable hard word. It is a real <button> so it is
   keyboard/AT reachable, but styled to sit inline in the sentence. */
.ww-word {
    font: inherit;
    color: var(--ww-hard);
    background: var(--ww-hard-bg);
    border: none;
    border-bottom: 3px solid var(--ww-hard);
    border-radius: 6px 6px 0 0;
    padding: 0 3px;
    margin: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}
.ww-word:active { background: #FED7AA; }
.ww-word.ww-active { background: var(--ww-accent); color: #fff; border-bottom-color: var(--ww-accent); }

/* ---- Definition sheet (slides up from the bottom) ------------------- */
.ww-sheet-bg {
    position: fixed; inset: 0;
    background: rgba(43, 37, 64, 0.45);
    display: none;
    z-index: 50;
}
.ww-sheet-bg.ww-show { display: block; }

.ww-sheet {
    position: fixed; left: 0; right: 0; bottom: 0;
    z-index: 51;
    background: var(--ww-surface);
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -8px 30px rgba(43, 37, 64, 0.28);
    padding: 16px 20px 28px;
    max-height: 78dvh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 0.22s ease-out;
}
.ww-sheet.ww-show { transform: translateY(0); }

.ww-sheet-grip {
    width: 44px; height: 5px; border-radius: 999px;
    background: var(--ww-border); margin: 0 auto 12px;
}

.ww-sheet-head { display: flex; align-items: center; gap: 12px; margin-bottom: 6px; }
.ww-sheet-word { font-size: 26pt; font-weight: 800; color: var(--ww-accent); letter-spacing: -0.5px; }
.ww-sheet-phon { font-size: 13pt; color: var(--ww-muted); }

.ww-hear {
    margin-left: auto;
    display: inline-flex; align-items: center; gap: 8px;
    padding: 12px 18px;
    border: none; border-radius: 999px;
    background: var(--ww-accent); color: #fff;
    font: 800 12pt "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
}
.ww-hear:active { transform: scale(0.97); }
.ww-hear.ww-speaking { background: var(--ww-hard); }
.ww-hear svg { width: 18px; height: 18px; fill: currentColor; }

.ww-sense { margin: 14px 0 0; }
.ww-pos {
    font-size: 12pt; font-weight: 800; font-style: italic;
    color: var(--ww-accent-2); margin-bottom: 4px;
}
.ww-deflist { margin: 0; padding-left: 22px; }
.ww-deflist li { font-size: 14pt; line-height: 1.55; margin: 5px 0; }

.ww-sheet-msg { font-size: 13pt; color: var(--ww-muted); padding: 18px 4px; text-align: center; }

.ww-sheet-close {
    margin-top: 18px;
    width: 100%;
    padding: 14px;
    border: 2px solid var(--ww-border);
    border-radius: 14px;
    background: var(--ww-surface);
    color: var(--ww-accent);
    font: 800 13pt "Segoe UI", system-ui, sans-serif;
    cursor: pointer;
}

/* ---- Tip footer ----------------------------------------------------- */
.ww-tip {
    margin: 22px 4px 0; color: var(--ww-muted);
    font-size: 11.5pt; line-height: 1.6;
}
.ww-tip strong { color: var(--ww-ink); }
