:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --line: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --accent: #111827;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: var(--text);
  background: var(--bg);
}
.container { max-width: 980px; margin: 0 auto; padding: 24px; }
.container.wide { max-width: 1320px; }
h1 { margin: 0 0 8px; font-size: 28px; }
h2 { margin: 0 0 10px; font-size: 18px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
}
.card img { max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); }
.toolbar {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin: 16px 0;
}
.topgap { margin-top: 12px; }
.btn, .download {
  display: inline-block;
  background: var(--accent);
  color: white;
  text-decoration: none;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: 700;
  cursor: pointer;
}
.btn.secondary { background: #475569; }
.canvasWrap {
  width: 100%;
  overflow: auto;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}
#canvas { max-width: 100%; display: block; margin: 0 auto; touch-action: none; }
.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.full { grid-column: 1 / -1; }
.checker {
  padding: 12px;
  border-radius: 10px;
  background-image:
    linear-gradient(45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(-45deg, #e5e7eb 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #e5e7eb 75%),
    linear-gradient(-45deg, transparent 75%, #e5e7eb 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0px;
}
.animWrap img { max-width: 520px; width: 100%; }
.downloadsRow { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
label { display: block; margin-bottom: 8px; font-weight: 700; }
input[type=file] { width: 100%; }
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; align-items: flex-start; }
}
.loginShell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.loginCard { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: 0 12px 36px rgba(15,23,42,.08); }
.textInput { width: 100%; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; margin: 6px 0 14px; font-size: 16px; }
.fullBtn { width: 100%; text-align: center; }
.navActions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.navActions form { margin: 0; }
.alert { padding: 12px 14px; border-radius: 10px; margin: 12px 0; font-weight: 700; }
.alert.error { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert.ok { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.settingsForm hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.canvasCard { position: relative; }
.canvasHelp { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.smallBtn { padding: 7px 10px; font-size: 12px; }
button:disabled, .btn:disabled { opacity: .45; cursor: not-allowed; }
.radioGrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.radioCard { display: grid; grid-template-columns: auto 1fr; column-gap: 10px; row-gap: 3px; align-items: start; border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; background: #fff; }
.radioCard strong { display: block; }
.radioCard span { grid-column: 2; color: var(--muted); font-size: 12px; line-height: 1.45; }
.radioCard.selected { border-color: #334155; box-shadow: 0 0 0 2px rgba(51,65,85,.12); }
.stickyActions { position: sticky; bottom: 0; background: rgba(246,247,251,.92); backdrop-filter: blur(6px); padding: 12px 0; }
@media (max-width: 860px) { .radioGrid { grid-template-columns: 1fr; } }
