/* Сайт гаджетов. Цвета те же, что на экране гаджета: светлый фон, тёмная шапка, оранжевый и синий. */
:root {
  --bg: #ecece8;
  --card: #fff;
  --ink: #222224;
  --dim: #6f6f6c;
  --line: #d9d9d3;
  --head: #202020;
  --accent: #ff9a00;
  --accent-ink: #a35b00;
  --blue: #00a2ff;
  --blue-ink: #0072b8;
  --bad: #c8381a;
  --radius: 12px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, Inter, Arial, sans-serif; }
a { color: var(--blue-ink); text-underline-offset: 2px; }
img, canvas { max-width: 100%; }
[hidden] { display: none !important; }
code { font: 14px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #f3f3ef; border: 1px solid var(--line); border-radius: 5px; padding: 0 4px; }

/* ---------- шапка ---------- */
.top { background: var(--head); color: #fff; }
.bar, .tabs, main { max-width: 1000px; margin: 0 auto; padding-left: 16px; padding-right: 16px; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 56px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: .14em; white-space: nowrap; }
.brand svg { width: 22px; height: 22px; fill: none; stroke: var(--accent); stroke-width: .22; stroke-linejoin: round; }
.who { display: flex; align-items: center; gap: 12px; margin: 0; min-width: 0; }
.who span { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who .out { font: inherit; font-size: 14px; color: #c9c9c4; background: none; border: 1px solid #4a4a48; border-radius: 8px; padding: 4px 10px; cursor: pointer; }
.who .out:hover { color: #fff; border-color: #777; }
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tabs a { flex: none; color: #c9c9c4; text-decoration: none; font-weight: 600; padding: 10px 12px 12px; border-bottom: 3px solid transparent; }
.tabs a:hover { color: #fff; }
.tabs a.on { color: #fff; border-bottom-color: var(--accent); }

/* ---------- страница ---------- */
main { padding-top: 24px; padding-bottom: 48px; }
h1 { font-size: 26px; line-height: 1.2; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 36px 0 14px; display: flex; align-items: baseline; gap: 10px; }
h2 small { color: var(--dim); font-size: 15px; font-weight: 500; }
.lead { color: var(--dim); margin: 0 0 20px; }
.card { background: var(--card); border-radius: var(--radius); border-top: 4px solid var(--blue); padding: 20px; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.card.orange { border-top-color: var(--accent); }
.card + .card { margin-top: 16px; }
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.muted { color: var(--dim); }

/* ---------- кнопки и поля ---------- */
button, .btn { font: inherit; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: #fff; color: var(--ink); text-decoration: none; cursor: pointer; }
button:hover, .btn:hover { border-color: #b9b9b2; }
button.primary, .btn.primary { background: var(--accent); border-color: var(--accent); color: #1c1c1c; }
button.primary:hover, .btn.primary:hover { background: #ffab2e; }
button:disabled { opacity: .45; cursor: default; }
button.wide { width: 100%; }
button.danger { min-height: 0; padding: 4px 0; border: 0; background: none; color: var(--bad); font-weight: 500; font-size: 14px; }
button:focus-visible, .btn:focus-visible, a:focus-visible, input:focus-visible { outline: 3px solid rgba(0, 162, 255, .45); outline-offset: 2px; }
label.field { display: block; font-weight: 600; margin: 18px 0 0; }
label.field small { display: block; font-weight: 400; font-size: 14px; color: var(--dim); }
input[type=text], input[type=number], input:not([type]) { display: block; width: 100%; margin-top: 6px; font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
textarea { display: block; width: 100%; margin-top: 6px; font: inherit; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); resize: vertical; min-height: 96px; }
textarea:focus-visible { outline: 3px solid rgba(0, 162, 255, .45); outline-offset: 2px; }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 10px 0 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 18px; }
.row > * { flex: 1 1 auto; }

.msg { min-height: 1.5em; margin: 14px 0 0; font-weight: 600; }
.msg.bad, output.bad { color: var(--bad); }
.msg.good, output.good { color: var(--blue-ink); }
output.warn { color: var(--accent-ink); }
output { display: block; font-size: 14px; margin-top: 6px; }

/* Выбор файла: сам input спрятан, нажимается вся плашка. */
.pick { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 120px; padding: 18px; border: 2px dashed #c4c4bd; border-radius: var(--radius); background: #f7f7f4; text-align: center; cursor: pointer; }
.pick:hover { border-color: var(--accent); }
.pick b { font-size: 17px; }
.pick span { color: var(--dim); font-size: 14px; overflow-wrap: anywhere; }
.pick input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.pick.small { min-height: 76px; }

/* Переключатель «Кадр / Целиком». */
.seg { display: inline-flex; padding: 3px; background: #ecece8; border-radius: 10px; }
.seg label { position: relative; flex: 1; text-align: center; }
.seg input { position: absolute; opacity: 0; }
.seg span { display: block; padding: 8px 16px; border-radius: 8px; font-weight: 600; color: var(--dim); cursor: pointer; }
.seg input:checked + span { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .12); }
.seg input:focus-visible + span { outline: 3px solid rgba(0, 162, 255, .45); }

/* ---------- экран гаджета: картинка 320×240 в тёмной рамке ---------- */
.screen { display: inline-block; max-width: 100%; padding: 10px; background: var(--head); border-radius: 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.screen img, .screen canvas { display: block; width: 320px; max-width: 100%; height: auto; aspect-ratio: 4 / 3; border-radius: 4px; background: #111; }
.screen canvas { touch-action: none; cursor: grab; }
.screen.big canvas { width: 480px; }

/* ---------- архив ---------- */
.now { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: start; }
.now .info { min-width: 0; }
.now .cap { font-size: 22px; font-weight: 700; line-height: 1.25; margin: 4px 0 6px; overflow-wrap: anywhere; }
.now .meta { color: var(--dim); margin: 0 0 16px; }
.empty { color: var(--dim); }
.devs { display: grid; gap: 10px; }
.dev-card { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.dev-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }
.dev-card p { margin: 4px 0 0; color: var(--dim); font-size: 14px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--dim); }
.pill i { width: 9px; height: 9px; border-radius: 50%; background: #b5b5ae; }
.pill.on { color: var(--blue-ink); }
.pill.on i { background: var(--blue); box-shadow: 0 0 0 3px rgba(0, 162, 255, .2); }

.scores { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.scores .card + .card { margin-top: 0; }
.score h3 { margin: 0 0 6px; font-size: 17px; }
.score ol { list-style: none; margin: 0; padding: 0; }
.score li { display: flex; align-items: baseline; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.score li:first-child { border-top: 0; }
.score .n { width: 16px; flex: none; color: var(--dim); font-variant-numeric: tabular-nums; }
.score .who { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.score .who small { color: var(--dim); font-size: 13px; margin-left: 4px; white-space: nowrap; }
.score b { font-variant-numeric: tabular-nums; }
.score li.first b { color: var(--accent-ink); }
.score .empty { margin: 8px 0 0; font-size: 14px; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.photo { margin: 0; background: var(--card); border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(0, 0, 0, .06); display: flex; flex-direction: column; }
.photo > a { display: block; background: #ddd; }
.photo img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.photo figcaption { padding: 10px 14px 12px; font-size: 14px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.photo .num { color: var(--dim); }
.photo .cap { font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.photo .acts { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin-top: auto; padding-top: 8px; }
.photo .acts form { margin: 0 0 0 auto; }
.photo:target { outline: 3px solid var(--accent); }

/* ---------- прошивка ---------- */
.steps { margin: 0; padding-left: 22px; }
.steps li + li { margin-top: 6px; }
.fw-files { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 18px; }
.fw-files .who-for { font-weight: 600; margin-bottom: 6px; }

/* ---------- релизы ---------- */
.rel-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.rel-head h2 { margin: 0; font-size: 24px; }
.badge { font-size: 13px; font-weight: 700; color: var(--accent-ink); background: rgba(255, 154, 0, .15); border-radius: 999px; padding: 2px 10px; }
.rel .notes { margin: 12px 0 0; white-space: normal; overflow-wrap: anywhere; }
.rel p.muted { margin: 12px 0 0; }
.rel p.pill { display: flex; margin: 12px 0 0; }
.rel details { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 10px; }
.rel summary { cursor: pointer; color: var(--blue-ink); font-weight: 600; font-size: 14px; }

/* ---------- вход ---------- */
.login { max-width: 420px; margin: 0 auto; }
.login h1 { margin-bottom: 4px; }
.glyphs { display: flex; gap: 10px; margin-top: 18px; }
.glyphs button { flex: 1; min-height: 0; padding: 6px; border: 2px solid var(--line); border-radius: 10px; background: #fff; }
.glyphs button.on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 154, 0, .2); }
.glyphs svg { display: block; width: 100%; aspect-ratio: 1; }
.pad { margin-top: 14px; background: #f7f7f4; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.hex { display: block; width: 100%; aspect-ratio: 1; touch-action: none; user-select: none; -webkit-user-select: none; cursor: crosshair; }
.step { text-align: center; color: var(--dim); font-weight: 600; margin: 10px 0 0; }
.hex .rim, .glyphs .rim { fill: none; stroke: #cfcfc8; stroke-width: .025; stroke-dasharray: .06 .05; }
.hex .edge { stroke: var(--accent); stroke-width: .09; stroke-linecap: round; }
.glyphs .edge { stroke: var(--ink); stroke-width: .13; stroke-linecap: round; }
.hex .tip { stroke: var(--accent); stroke-opacity: .5; stroke-width: .06; stroke-linecap: round; }
.hex .dot { fill: var(--head); }
.hex .dot.on { fill: var(--blue); }
.glyphs .dot { fill: #9a9a94; }
.login .row button { white-space: nowrap; }
.login .row #clear { flex: none; }
.login .row #go { flex: 1 1 120px; }
.pad .hex { max-width: 320px; margin: 0 auto; }

/* ---------- телефон ---------- */
@media (max-width: 640px) {
  main { padding-top: 18px; }
  h1 { font-size: 23px; }
  .card { padding: 16px; }
  .now { grid-template-columns: 1fr; gap: 16px; }
  .now .screen { justify-self: center; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .photo figcaption { padding: 8px 10px 10px; }
  .photo .acts form { margin-left: 0; }
  .fw-files { grid-template-columns: 1fr; }
  .brand { font-size: 12px; letter-spacing: .1em; }
  .tabs { gap: 0; padding-left: 8px; padding-right: 8px; }
  .tabs a { padding: 10px 8px 12px; font-size: 15px; }
  .tabs .long { display: none; }
}
@media (max-width: 360px) {
  .grid { grid-template-columns: 1fr; }
}
