/* Microscopul virtual — stiluri. Fără fonturi externe (CSP). */
:root {
  --bg: #f6f7f5;
  --card: #ffffff;
  --fg: #1d2421;
  --muted: #5f6b66;
  --line: #dde2de;
  --accent: #2f6f4f;
  --accent-2: #e7f1ec;
  --ok: #1f7a3d;
  --ok-bg: #e5f4ea;
  --bad: #b3261e;
  --bad-bg: #fbe9e7;
  --warn: #8a5a00;
  --warn-bg: #fff4dc;
  --claude: #6a4c93;
  --stage: #0c0d0e;
  --hl: #ffd21f;
  --sel: #23c4ff;
  --reveal: #3ddc84;
  --radius: 10px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg); color: var(--fg);
  -webkit-text-size-adjust: 100%;
}
button {
  font: inherit; color: inherit; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); border-radius: 8px;
  padding: 7px 12px; min-height: 36px;
}
button:hover { border-color: #b9c3bd; }
button:focus-visible, a:focus-visible, input:focus-visible, #field:focus-visible {
  outline: 3px solid #4a90e2; outline-offset: 2px;
}
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
button.primary:hover { background: #255c41; }
button.ghost { background: transparent; border-color: transparent; }
button.ghost:hover { background: rgba(0,0,0,.05); }
button[disabled] { opacity: .5; cursor: default; }
a { color: var(--accent); }
[hidden] { display: none !important; }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* --- antet --- */
#top {
  flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; background: var(--card); border-bottom: 1px solid var(--line);
}
#top .ttl { flex: 1; min-width: 0; }
#top h1 { font-size: 16px; margin: 0; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top p { margin: 0; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#top p i { font-style: italic; }
#back { padding: 6px 8px; white-space: nowrap; }
#modes { display: flex; gap: 2px; background: #eef1ef; padding: 3px; border-radius: 10px; }
#modes button { border: 0; background: transparent; padding: 6px 12px; min-height: 34px; border-radius: 8px; font-size: 14px; }
#modes button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.15); font-weight: 600; color: var(--accent); }

/* --- lista lucrărilor --- */
#home { flex: 1; overflow: auto; padding: 18px 16px 32px; }
#home .wrap { max-width: 960px; margin: 0 auto; }
#home .intro { color: var(--muted); max-width: 70ch; margin: 0 0 18px; }
#home h2 { font-size: 15px; margin: 22px 0 10px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
#home h2 b { color: var(--fg); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.lcard {
  display: block; text-decoration: none; color: inherit; background: var(--card);
  border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-height: 92px;
  transition: border-color .15s, box-shadow .15s;
}
a.lcard:hover { border-color: var(--accent); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.lcard .nr { font-size: 12px; color: var(--accent); font-weight: 700; }
.lcard .t { font-weight: 600; margin: 2px 0; }
.lcard .sp { font-style: italic; color: var(--muted); font-size: 13.5px; }
.lcard .best { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.lcard.off { opacity: .55; }
.lcard.off .best { font-style: italic; }

/* --- spațiul de lucru --- */
#work { flex: 1; min-height: 0; display: flex; }
#stage {
  position: relative; flex: 1; min-width: 0; min-height: 0; overflow: hidden;
  background: radial-gradient(circle at 50% 45%, #1b1d1f 0, var(--stage) 70%);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
#field {
  position: absolute; border-radius: 50%; overflow: hidden; background: #fff;
  box-shadow: 0 0 0 3px #000, 0 0 0 9px #1a1a1a, 0 0 32px 12px rgba(0,0,0,.65);
  cursor: grab; touch-action: none;
}
#field.dragging { cursor: grabbing; }
#field.testing { cursor: crosshair; }
#fsvg { position: absolute; left: 0; top: 0; display: block; }
.vignette {
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgba(0,0,0,0) 60%, rgba(0,0,0,.12) 78%, rgba(0,0,0,.42) 94%, rgba(0,0,0,.7) 100%);
}
#world [data-min] { transition: opacity .35s ease, visibility .35s; }

#lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
#lines .ln { stroke: #fff; stroke-width: 1.4; fill: none; }
#lines .lnb { stroke: rgba(0,0,0,.55); stroke-width: 3.4; fill: none; }
#lines .dot { fill: #fff; stroke: rgba(0,0,0,.6); stroke-width: 1.5; }
#lines .sel .ln, #lines .sel .dot { stroke: var(--sel); }
#lines .sel .dot { fill: var(--sel); }
#lines .rev .ln, #lines .rev .dot { stroke: var(--reveal); }
#lines .rev .dot { fill: var(--reveal); }
#lines .ring { fill: none; stroke: var(--reveal); stroke-width: 3; animation: ring 1.2s ease-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ring { from { opacity: 1; transform: scale(.6); } to { opacity: 0; transform: scale(1.8); } }
#lines .pin-ok { fill: none; stroke: var(--reveal); stroke-width: 3; }
#lines .pin-bad { stroke: #ff5a4f; stroke-width: 3; stroke-linecap: round; }
#lines .pin-halo { fill: none; stroke: rgba(0,0,0,.55); stroke-width: 5.5; stroke-linecap: round; }

#labels { position: absolute; inset: 0; pointer-events: none; }
.lbl {
  position: absolute; left: 0; top: 0; white-space: nowrap; pointer-events: auto; cursor: pointer;
  font-size: 12.5px; line-height: 1; padding: 4px 7px; border-radius: 6px;
  background: rgba(16, 20, 18, .82); color: #fff; border: 1px solid rgba(255,255,255,.25);
  will-change: transform;
}
#labels.probe .lbl { pointer-events: none; }
.lbl:hover, .lbl.hov { border-color: var(--hl); }
.lbl.sel { background: #06364a; border-color: var(--sel); }
.lbl.rev { background: #0c4a2a; border-color: var(--reveal); }

#objbar { position: absolute; left: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; }
#objbar button, #tools button, #tools2 button {
  background: rgba(24, 27, 26, .86); color: #f1f4f2; border: 1px solid rgba(255,255,255,.22);
  min-width: 46px; min-height: 40px; padding: 6px 10px; font-weight: 600; font-size: 14px;
}
#objbar button:hover, #tools button:hover, #tools2 button:hover { border-color: rgba(255,255,255,.55); }
#objbar button.on { background: #f1f4f2; color: #111; border-color: #fff; }
#tools { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#tools #zin, #tools #zout { font-size: 18px; padding: 2px 0; width: 46px; }
#tools2 { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
#tools2 button[aria-pressed="true"] { background: #f1f4f2; color: #111; }
#zinfo {
  position: absolute; left: 10px; bottom: 10px; color: #d8ddda; font-size: 12.5px;
  background: rgba(0,0,0,.45); padding: 4px 8px; border-radius: 6px; pointer-events: none;
}
#toast {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); max-width: calc(100% - 140px);
  background: rgba(255,255,255,.95); color: #111; padding: 7px 12px; border-radius: 8px; font-size: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,.4); opacity: 0; transition: opacity .2s; pointer-events: none; text-align: center;
}
#toast.show { opacity: 1; }
#toast.bad { background: #fff0ee; color: var(--bad); }
#toast.ok { background: #effaf2; color: var(--ok); }
#toast.warn { background: #fff7e3; color: var(--warn); }

#loading {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center;
  color: #e8ece9; background: rgba(12, 13, 14, .85); padding: 20px; z-index: 2;
}
#loading .spin {
  width: 34px; height: 34px; margin: 0 auto 10px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25); border-top-color: #fff; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
#loading.err p:first-child { font-weight: 600; color: #ffb4ab; }
#loading .actions { justify-content: center; }
#loading button:not(.primary) { color: var(--fg); }

/* --- panoul --- */
#panel {
  flex: none; width: 360px; overflow: auto; background: var(--card); border-left: 1px solid var(--line);
  padding: 14px 16px 24px;
}
#panel h2 { font-size: 18px; margin: 0 0 4px; }
#panel h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 18px 0 8px; }
#panel p { margin: 6px 0; }
.pbtns { display: flex; flex-wrap: wrap; gap: 6px; }
.pbtns button { font-size: 13.5px; padding: 6px 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.badge {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 7px; border-radius: 999px;
  background: var(--accent-2); color: var(--accent); vertical-align: middle;
}
.badge.claude { background: #f0eaf8; color: var(--claude); }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; }
.card.sel { border-color: var(--sel); box-shadow: 0 0 0 2px rgba(35,196,255,.18); }
.card .meta { font-size: 13px; color: var(--muted); }
.expl { background: #f7f8f7; border-left: 3px solid var(--accent); padding: 8px 10px; border-radius: 0 6px 6px 0; margin-top: 10px; }
.expl.claude { border-left-color: var(--claude); background: #faf8fd; }
.expl .h { font-size: 12.5px; font-weight: 700; color: var(--muted); margin-bottom: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.chips button { font-size: 13px; padding: 3px 9px; min-height: 30px; border-radius: 999px; }
.ellist { list-style: none; padding: 0; margin: 0; }
.ellist li + li { border-top: 1px solid #eef0ee; }
.ellist button {
  width: 100%; text-align: left; border: 0; border-radius: 6px; background: transparent;
  display: flex; align-items: center; gap: 8px; padding: 7px 6px; min-height: 38px;
}
.ellist button:hover { background: #f2f5f3; }
.ellist button.sel { background: #e8f7fd; }
.ellist .n { flex: 1; }
.ellist .grp { font-size: 12px; color: var(--muted); }
.ellist .ob { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ellist .ob.dim { color: #b0b8b3; }
.hint { font-size: 13.5px; color: var(--muted); background: #f5f7f6; border-radius: 8px; padding: 9px 11px; margin-top: 12px; }

/* --- teste --- */
.qhead { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.prog { height: 6px; background: #edf0ee; border-radius: 3px; overflow: hidden; margin: 6px 0 12px; }
.prog > div { height: 100%; background: var(--accent); transition: width .3s; }
.ask { font-size: 20px; font-weight: 700; margin: 6px 0; }
.clue { font-size: 16px; background: #f7f8f7; border-radius: 8px; padding: 10px 12px; }
.tries { font-size: 13px; color: var(--muted); }
.fb { margin-top: 10px; padding: 9px 11px; border-radius: 8px; font-size: 14.5px; }
.fb.ok { background: var(--ok-bg); color: var(--ok); }
.fb.bad { background: var(--bad-bg); color: var(--bad); }
.fb.warn { background: var(--warn-bg); color: var(--warn); }
.fb.info { background: #eef4fb; color: #22507e; }
.namerow { display: flex; gap: 6px; margin-top: 10px; }
.namerow input {
  flex: 1; min-width: 0; font: inherit; padding: 8px 10px; border: 1px solid #c8d0cb; border-radius: 8px; min-height: 40px;
}
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.opts { display: flex; flex-wrap: wrap; gap: 14px; margin: 10px 0; }
.opts label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.score { font-size: 34px; font-weight: 800; margin: 4px 0; }
.results { list-style: none; padding: 0; margin: 8px 0 0; font-size: 14px; }
.results li { padding: 5px 0; border-top: 1px solid #eef0ee; display: flex; gap: 8px; }
.results .ic { width: 18px; flex: none; font-weight: 700; }
.results .ic.ok { color: var(--ok); }
.results .ic.bad { color: var(--bad); }

/* --- fereastra de dialog --- */
#modal { position: fixed; inset: 0; background: rgba(10, 14, 12, .55); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.mbox { background: var(--card); border-radius: 12px; max-width: 680px; width: 100%; max-height: 100%; display: flex; flex-direction: column; box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.mhead { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px 18px; border-bottom: 1px solid var(--line); }
.mhead h2 { flex: 1; margin: 0; font-size: 17px; }
#mbody { padding: 12px 18px 18px; overflow: auto; }
#mbody h3 { font-size: 14px; margin: 14px 0 4px; }
#mbody figure { margin: 12px 0 18px; }
#mbody img { max-width: 100%; height: auto; border-radius: 8px; display: block; background: #eee; }
#mbody figcaption { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* --- ecrane înguste (telefon, iframe îngust) --- */
@media (max-width: 760px) {
  #work { flex-direction: column; }
  #stage { flex: none; height: min(100vw, 58vh); height: min(100vw, 58dvh); }
  #panel { width: auto; flex: 1; min-height: 0; border-left: 0; border-top: 1px solid var(--line); padding: 12px 14px 20px; }
  #modes { width: 100%; order: 3; }
  #modes button { flex: 1; padding: 6px 4px; font-size: 13.5px; }
  #top { padding: 6px 10px; gap: 6px; }
  #top h1 { font-size: 15px; }
  .lbl { font-size: 11.5px; padding: 3px 6px; }
  #objbar button, #tools button, #tools2 button { min-width: 42px; min-height: 38px; padding: 4px 8px; font-size: 13px; }
  #tools #zin, #tools #zout { width: 42px; }
  #toast { max-width: calc(100% - 24px); bottom: 52px; }
}
@media (max-height: 520px) and (min-width: 761px) {
  #objbar button, #tools button, #tools2 button { min-height: 32px; padding: 3px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  #world [data-min], .prog > div, #toast { transition: none; }
  #lines .ring, #loading .spin { animation: none; }
}
