:root {
  --bg: #f6f7fb; --surface: #ffffff; --text: #171a22; --muted: #5d6475; --line: #dfe3ee;
  --accent: #2f5bea; --accent-text: #ffffff; --danger: #c62828; --warn-bg: #fff4d6; --warn-text: #6b4b00;
  --radius: 12px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1117; --surface: #181b25; --text: #e8eaf2; --muted: #9aa2b6; --line: #2a2f3e;
    --accent: #6c8cff; --accent-text: #0b0d14; --danger: #ff6b6b; --warn-bg: #3a2f0d; --warn-text: #ffd978;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1117; --surface: #181b25; --text: #e8eaf2; --muted: #9aa2b6; --line: #2a2f3e;
  --accent: #6c8cff; --accent-text: #0b0d14; --danger: #ff6b6b; --warn-bg: #3a2f0d; --warn-text: #ffd978;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 860px; margin: 0 auto; padding: 0 16px; }
a { color: var(--accent); }
h1 { font-size: 1.9rem; line-height: 1.2; margin: .2em 0 .4em; }
h2 { font-size: 1.25rem; margin: 0 0 .6em; }
h2.sec { margin-top: 2rem; }
code { background: var(--bg); border: 1px solid var(--line); padding: 0 .3em; border-radius: 4px; }

.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.bar { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { color: var(--text); font-weight: 700; text-decoration: none; display: flex; gap: .5rem; align-items: center; }
.badge { background: var(--accent); color: var(--accent-text); border-radius: 6px; padding: 1px 6px; font-size: .75rem; letter-spacing: .04em; }
nav { display: flex; align-items: center; gap: 1rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a.on, nav a:hover { color: var(--text); }
.icon { border: 1px solid var(--line); background: transparent; color: var(--text); border-radius: 8px; width: 34px; height: 34px; padding: 0; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.icon svg { display: block; }

main { padding-top: 1.5rem; padding-bottom: 3rem; }
.hero { text-align: center; padding: 1.5rem 0 .5rem; }
.hero p { color: var(--muted); max-width: 560px; margin: 0 auto; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; margin: 1.25rem 0; }
.panel.center { text-align: center; max-width: 560px; margin: 2rem auto; }
.prose h2 { margin-top: 1.5rem; }

.presets { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .75rem; }
.card { text-align: left; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: .9rem; cursor: pointer; font: inherit; display: flex; flex-direction: column; gap: .25rem; }
.card:hover { border-color: var(--accent); }
.card span { color: var(--muted); font-size: .88rem; }

.tabs { display: flex; gap: .4rem; margin-bottom: .8rem; }
.tab { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 8px; padding: .4rem .9rem; cursor: pointer; font: inherit; }
.tab.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }

textarea, input[type=text], input[type=password], select {
  width: 100%; font: inherit; font-size: 1rem; /* >=16px: sub asta iOS Safari face zoom la focus */ color: var(--text); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: .6rem .7rem;
}
textarea { resize: vertical; min-height: 140px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.counter { text-align: right; color: var(--muted); font-size: .8rem; margin-top: .2rem; }

.drop { display: block; border: 2px dashed var(--line); border-radius: var(--radius); padding: 1.6rem; text-align: center; color: var(--muted); cursor: pointer; }
.drop input { display: none; }
#image-preview { max-width: 100%; max-height: 260px; display: block; margin: .8rem auto 0; border-radius: 8px; }
#image-preview[hidden] { display: none; }

.check { display: flex; gap: .5rem; align-items: flex-start; margin: 1rem 0 .5rem; }
.check input { margin-top: .35rem; }
details { border-top: 1px solid var(--line); padding: .7rem 0; }
details summary { cursor: pointer; font-weight: 600; }
details p { margin: .5rem 0 0; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; margin-top: .8rem; }
.grid2 label, .stack { display: flex; flex-direction: column; gap: .3rem; font-size: .9rem; text-align: left; }
.stack { margin: 1rem 0; }
.hint { color: var(--muted); font-size: .85rem; }

button, .btn { font: inherit; cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 8px; padding: .55rem 1rem; text-decoration: none; display: inline-block; }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); font-weight: 600; }
#create, #reveal { width: 100%; padding: .8rem; margin-top: .8rem; }
button:disabled { opacity: .6; cursor: wait; }

.linkrow { display: flex; gap: .5rem; margin: 1rem 0; }
.error { color: var(--danger); margin: .6rem 0 0; }
.warn { background: var(--warn-bg); color: var(--warn-text); padding: .7rem .9rem; border-radius: 8px; }

pre { white-space: pre-wrap; word-break: break-word; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: .9rem; font: .95rem/1.5 ui-monospace, Menlo, Consolas, monospace; }
#img { max-width: 100%; border-radius: 8px; }

.steps { padding-left: 1.2rem; }
.steps li { margin: .5rem 0; }
.steps b { display: block; }

.row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--line); }

.foot { border-top: 1px solid var(--line); color: var(--muted); font-size: .85rem; padding: 1.2rem 0; }
.foot p { margin: .2rem 0; }

[hidden] { display: none !important; }
@media (max-width: 560px) {
  .grid2 { grid-template-columns: 1fr; }
  .row { flex-direction: column; align-items: flex-start; }
  nav { gap: .6rem; }
}

/* Mode switch */
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin: 1rem 0 .5rem; }
.mode { text-align: left; display: flex; flex-direction: column; gap: .15rem; background: var(--surface); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem .9rem; font: inherit; cursor: pointer; }
.mode span { color: var(--muted); font-size: .82rem; }
.mode.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.notice { background: var(--bg); border: 1px solid var(--accent); border-radius: 8px; padding: .7rem .9rem; margin: 0 0 1rem; }
@media (max-width: 640px) { .modes { grid-template-columns: 1fr; } }

.btnrow { display: flex; flex-wrap: wrap; gap: .5rem; margin: .6rem 0; }
.mt { margin-top: 1.2rem; }

/* meniul de sus e sticky (56px): lasa loc sa nu acopere titlul la scroll */
#presets, #composer { scroll-margin-top: 72px; }

.card.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.modeline { margin: .2rem 0 .8rem; font-weight: 600; color: var(--accent); }
#offline { scroll-margin-top: 72px; }

.pwdrow { display: flex; gap: .5rem; }
.pwdrow input { flex: 1; min-width: 0; }
.pwdrow button { white-space: nowrap; }

/* Fara depasire pe orizontala: numele lungi de fisiere / siruri fara spatii se rup in loc sa largeasca pagina */
body { overflow-wrap: break-word; }
.drop, .drop span, .hint, .error, .notice, pre, #dl-info, .modeline, .row { overflow-wrap: anywhere; word-break: break-word; min-width: 0; }
.drop { overflow: hidden; }
img, textarea, input, select { max-width: 100%; }
/* plasa de siguranta (iOS): chiar daca ceva depaseste, pagina nu se poate trage lateral */
html { overflow-x: clip; }

/* subsol: text pe stanga, "No cookies" pe dreapta */
.footrow { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.foot .nocookies { margin: 0 0 0 auto; white-space: nowrap; text-align: right; }
/* meniu pe ecrane inguste: 4 linkuri + tema trebuie sa incapa */
@media (max-width: 430px) { nav { gap: .55rem; font-size: .92rem; } .brand { font-size: .95rem; } .brand .badge { font-size: .7rem; } }
