:root {
  --bg: #0d1117;
  --panel: #151b23;
  --panel-2: #1c2430;
  --border: #2a3441;
  --fg: #e6edf3;
  --dim: #8b96a5;
  --accent: #56d2c2;
  --accent-2: #ff8a5c;
  --bad: #ff5c7a;
  --good: #56d2c2;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 15px;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 60px;
}

main {
  width: 100%;
  max-width: 880px;
}

header {
  text-align: center;
  margin-bottom: 20px;
}

h1 {
  font-size: 2rem;
  margin: 0 0 6px;
  letter-spacing: -0.02em;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

h1 .stroke {
  display: inline-block;
}

header p {
  color: var(--dim);
  margin: 0 auto;
  max-width: 560px;
  line-height: 1.5;
}

header p a { color: var(--accent); }

.origin {
  font-size: 0.82rem;
  margin-top: 10px;
  color: #5a6472;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 14px;
}

.toolbar .spacer { flex: 1; }

button, .file-btn {
  font-family: var(--mono);
  font-size: 0.85rem;
  background: var(--panel-2);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s, transform .05s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

button:hover, .file-btn:hover {
  border-color: var(--accent);
}

button:active { transform: scale(0.97); }

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(90deg, var(--accent), #3fb8a8);
  color: #04211d;
  border: none;
  font-weight: 700;
}

button.tool.active {
  border-color: var(--accent);
  color: var(--accent);
  background: #12312c;
}

button.tool.erase.active {
  border-color: var(--bad);
  color: var(--bad);
  background: #33141d;
}

input[type="file"] { display: none; }

.canvas-wrap {
  position: relative;
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  background:
    linear-gradient(45deg, #10161f 25%, transparent 25%) -12px 0/24px 24px,
    linear-gradient(-45deg, #10161f 25%, transparent 25%) -12px 0/24px 24px,
    #0a0f16;
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
}

.canvas-wrap.erase-mode canvas { cursor: cell; }

.hint {
  color: var(--dim);
  font-size: 0.8rem;
  margin-top: 10px;
  line-height: 1.5;
}

.stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  color: var(--dim);
  margin-top: 10px;
}

.stats b { color: var(--fg); }

.result {
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 0.9rem;
  line-height: 1.6;
  display: none;
}

.result.show { display: block; }

.result.ok {
  background: #0f2a26;
  border: 1px solid #1f6e5f;
  color: #c8f5ec;
}

.result.bad {
  background: #2a1319;
  border: 1px solid #6e2438;
  color: #ffd3dc;
}

.result h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.result .odd-list {
  color: var(--bad);
}

.share-row {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.share-row.show { display: flex; }

footer {
  text-align: center;
  color: #4a5462;
  font-size: 0.78rem;
  margin-top: 30px;
  line-height: 1.6;
}

footer a { color: var(--dim); }

@media (max-width: 520px) {
  h1 { font-size: 1.5rem; }
  .toolbar { justify-content: center; }
}
