:root {
  --bg: #0d0f1a;
  --surface: rgba(255,255,255,0.04);
  --surface-hover: rgba(255,255,255,0.08);
  --border: rgba(255,255,255,0.12);
  --border-bright: rgba(255,255,255,0.2);
  --text: #e8eaf6;
  --text-muted: rgba(232,234,246,0.45);
  --text-dim: rgba(232,234,246,0.25);
  --accent: #7c6ff7;
  --accent2: #5ee7df;
  --verb: #b8a1ff;
  --verb-bg: rgba(167,139,250,0.1);
  --verb-border: rgba(167,139,250,0.25);
  --noun: #7cb3f7;
  --noun-bg: rgba(96,165,250,0.1);
  --noun-border: rgba(96,165,250,0.25);
  --adj: #54e0a7;
  --adj-bg: rgba(52,211,153,0.1);
  --adj-border: rgba(52,211,153,0.25);
  --danger: #f87171;
}

* {
  box-sizing: border-box; margin: 0; padding: 0;
  -webkit-tap-highlight-color: transparent !important;
  outline: none !important;
}

body, textarea, input, select, button {
  font-family: 'Varela Round', sans-serif;
}

body {
  background: #0d0f1a;
  color: var(--text);
  min-height: 100vh;
}

/* HEADER - UNIFORM DARK BACKGROUND */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 16px; border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  background: #0d0f1a;
}
.logo {
  font-family: 'Outfit', sans-serif; font-size: 1.15rem; font-weight: 700;
  letter-spacing: -0.02em;
}
.logo span { background: linear-gradient(135deg, var(--accent), var(--accent2)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.user-chip {
  display: flex; align-items: center; gap: 6px;
  background: transparent; border: none;
  padding: 0; font-size: 0.8rem; color: inherit;
}
.user-chip .avatar {
  width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  display: flex; align-items: center; justify-content: center;
  font-size: 0.68rem; font-weight: 700; color: #fff;
}

/* TABS - NO TAP HIGHLIGHT / NO TURQUOISE FLASH */
.tabs {
  display: flex; gap: 4px; padding: 8px 10px 0;
  background: #0d0f1a;
  position: sticky; top: 0; z-index: 40;
}
.tab {
  display: flex; align-items: center; justify-content: center;
  padding: 7px 16px; font-size: 0.8rem; font-weight: 500;
  border-radius: 10px 10px 0 0; cursor: pointer;
  border: 1px solid transparent;
  color: var(--text-muted); background: transparent;
  -webkit-tap-highlight-color: transparent !important;
  user-select: none; -webkit-user-select: none;
}
.tab.active {
  background: #0d0f1a;
  border: 1px solid var(--border);
  border-bottom-color: #0d0f1a;
  color: var(--text);
  font-weight: 600;
}
.tab:not(.active) {
  border-bottom: 1px solid var(--border);
}

/* MAIN — UNIFORM SEAMLESS CONTAINER */
main { max-width: 100%; margin: 0 auto; padding: 4px 12px 14px; background: #0d0f1a; }

/* PANELS */
.panel { display: none; }
.panel.active { display: block; }

/* ACCESS DENIED */
#access-denied {
  display: none; flex-direction: column; align-items: center;
  justify-content: center; min-height: 70vh; text-align: center; gap: 14px;
}
#access-denied .icon { font-size: 3rem; }
#access-denied h2 { font-family: 'Outfit', sans-serif; }
#access-denied p { color: var(--text-muted); max-width: 300px; line-height: 1.6; }

/* INPUT CARD */
.input-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; padding: 18px; margin-bottom: 24px;
  transition: border-color 0.2s;
}
.input-card:focus-within { border-color: var(--border-bright); }
.input-label { font-size: 0.76rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 10px; }
textarea {
  width: 100%; background: transparent; border: none; outline: none;
  color: var(--text); font-family: 'Inter', sans-serif;
  font-size: 1rem; line-height: 1.7; resize: none; min-height: 110px;
}
textarea::placeholder { color: var(--text-dim); }
.input-footer {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border);
}
.char-count { font-size: 0.76rem; color: var(--text-dim); }

/* BUTTONS */
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #5c6bc0);
  color: #fff; border: none; border-radius: 50px;
  padding: 8px 22px; font-family: 'Outfit', sans-serif;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
  transition: opacity 0.2s, transform 0.15s;
  display: inline-flex; align-items: center; gap: 7px;
}
.btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-secondary {
  background: none; border: 1px solid var(--border); border-radius: 50px;
  color: var(--text-muted); font-size: 0.78rem; padding: 5px 14px;
  cursor: pointer; transition: all 0.2s; display: inline-flex; align-items: center; gap: 5px;
}
.btn-secondary:hover { border-color: var(--border-bright); color: var(--text); }
.btn-danger {
  background: none; border: none; color: var(--danger); cursor: pointer;
  font-size: 0.78rem; padding: 4px 8px; border-radius: 6px;
  transition: background 0.15s; opacity: 0.7;
}
.btn-danger:hover { background: rgba(248,113,113,0.1); opacity: 1; }
.spinner { width: 13px; height: 13px; border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* READER HEADER — EVEN SPACING */
.reader-header {
  display: flex; align-items: center; justify-content: flex-end;
  margin-top: 0px; margin-bottom: 8px;
}
.reader-actions { display: flex; gap: 8px; align-items: center; }

/* READER CARD — SEAMLESS BORDERLESS TYPOGRAPHY */
.reader-card {
  background: transparent; border: none;
  border-radius: 0; padding: 4px 2px; line-height: 2.1; font-size: 1.05rem;
}

/* WORD TOKENS — SOFT PASTEL COLORED TEXT & TRANSLUCENT HIGHLIGHT BOXES */
.word-token {
  display: inline; position: relative; cursor: pointer;
  border-radius: 4px; padding: 2px 4px; transition: filter 0.15s;
}
.word-token.verb { color: var(--verb); background: var(--verb-bg); border-bottom: 1px solid var(--verb-border); }
.word-token.substantiv { color: var(--noun); background: var(--noun-bg); border-bottom: 1px solid var(--noun-border); }
.word-token.adjektiv { color: var(--adj); background: var(--adj-bg); border-bottom: 1px solid var(--adj-border); }
.word-token:hover { filter: brightness(1.3); }

/* LOADING */
.analyzing-msg { display: none; text-align: center; padding: 28px; color: var(--text-muted); font-size: 0.88rem; }
.analyzing-msg::after { content: ''; animation: dots 1.5s steps(4, end) infinite; }
@keyframes dots { 0%,20%{content:'.'} 40%{content:'..'} 60%,80%{content:'...'} 100%{content:''} }

/* SAVED TEXTS LIST */
.saved-list { display: flex; flex-direction: column; gap: 10px; }
.saved-item {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: border-color 0.2s, background 0.2s; cursor: pointer;
}
.saved-item:hover { border-color: var(--border-bright); background: var(--surface-hover); }
.saved-item-body { flex: 1; min-width: 0; }
.saved-item-title { font-size: 0.9rem; font-weight: 500; margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-item-date { font-size: 0.73rem; color: var(--text-dim); }
.empty-state { text-align: center; padding: 48px 20px; color: var(--text-dim); }
.empty-state .empty-icon { font-size: 2.5rem; margin-bottom: 10px; }
.empty-state p { font-size: 0.88rem; }

/* FIXED BOTTOM DOCK TOOLTIP */
#tooltip-box {
  display: none; position: fixed;
  bottom: 20px; left: 50%; transform: translateX(-50%);
  background: rgba(16,18,32,0.75); backdrop-filter: blur(2px);
  border: 1px solid rgba(255,255,255,0.12); border-radius: 18px;
  padding: 16px 20px; width: calc(100% - 40px); max-width: 760px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8); z-index: 300;
  transition: opacity 0.2s, transform 0.2s;
}
.tt-word { font-family: 'Outfit', sans-serif; font-size: 1.25rem; font-weight: 700; margin-bottom: 2px; }
.tt-word.verb { color: var(--verb); } .tt-word.substantiv { color: var(--noun); } .tt-word.adjektiv { color: var(--adj); }
.tt-pos { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 10px; }
.tt-encounter { font-size: 0.73rem; color: var(--text-dim); font-style: italic; margin-bottom: 10px; }
.tt-divider { height: 1px; background: var(--border); margin-bottom: 10px; }
.form-row { display: grid; grid-template-columns: 130px 1fr auto; align-items: center; padding: 5px 0; gap: 10px; }
.form-label { font-size: 0.68rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.06em; flex-shrink: 0; }
.form-value { font-size: 0.88rem; color: var(--text); font-weight: 500; text-align: left; word-break: break-word; }
.play-btn {
  background: var(--surface-hover); border: 1px solid var(--border);
  border-radius: 50%; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.15s, transform 0.15s;
  flex-shrink: 0; font-size: 0.6rem; color: var(--text-muted);
}
.play-btn:hover { background: rgba(124,111,247,0.25); color: var(--accent); transform: scale(1.1); }
.play-btn.playing { color: var(--accent2); border-color: var(--accent2); }

::-webkit-scrollbar { width: 5px; } ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 3px; }
