/* Aris Kingdom · 公共画板 —— 暖色像素风（纯 CSS，零依赖） */

:root {
  --canvas: #f0ead6;      /* 米白画布 */
  --ink: #3a2e24;         /* 深棕墨 */
  --ink-soft: #6b5d4f;
  --paper: #fff9ec;
  --paper-2: #f7ecda;
  --line: #e3d5b8;
  --accent: #e86a5e;
  --accent-2: #5ea8d8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background:
    repeating-linear-gradient(0deg, transparent 0 22px, rgba(58,46,36,.035) 22px 23px),
    repeating-linear-gradient(90deg, transparent 0 22px, rgba(58,46,36,.035) 22px 23px),
    var(--paper);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ---------- 顶部 ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: linear-gradient(180deg, #fffdf6, #f7ecda);
  border-bottom: 2px solid var(--line);
  box-shadow: 0 2px 0 rgba(58,46,36,.05);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-gem {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background:
    linear-gradient(135deg, #e86a5e 25%, #f0c75e 25% 50%, #5ea8d8 50% 75%, #7ec850 75%);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--ink);
  flex: 0 0 auto;
}

.brand-text strong {
  display: block;
  font-size: 19px;
  letter-spacing: .5px;
}

.brand-text small {
  display: block;
  color: var(--ink-soft);
  font-size: 12px;
  margin-top: 2px;
}

.stats {
  display: flex;
  gap: 18px;
  margin-left: auto;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 96px;
}

.stat-label {
  font-size: 11px;
  color: var(--ink-soft);
}

.stat-value {
  font-size: 15px;
  font-weight: 700;
}

.stat--painters .stat-value {
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.back-link {
  color: var(--accent-2);
  font-size: 13px;
  text-decoration: none;
  padding: 6px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--paper-2);
}

.back-link:hover { border-color: var(--accent-2); }

/* ---------- 主体 ---------- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px 12px 8px;
}

.palette-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 2px solid var(--ink);
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(58,46,36,.25);
  transition: transform .06s ease;
  padding: 0;
}

.swatch:hover { transform: translateY(-2px); }

.swatch.is-active {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- 画板 ---------- */
.board-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1;
  min-height: 0;
}

#board {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  background: var(--canvas);
  border: 3px solid var(--ink);
  border-radius: 6px;
  box-shadow:
    4px 4px 0 rgba(58,46,36,.22),
    0 12px 28px rgba(58,46,36,.12);
  cursor: crosshair;
  touch-action: manipulation;
}

/* ---------- 底部操作 ---------- */
.paint-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
  padding: 4px 0 12px;
}

.field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-soft);
}

.field input {
  font: inherit;
  color: var(--ink);
  padding: 7px 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: #fff;
  width: 160px;
}

.field input:focus { outline: none; border-color: var(--accent-2); }

.paint-hint {
  font-size: 12px;
  color: var(--ink-soft);
}

.paint-hint code, .foot code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: #f0e6d2;
  border-radius: 4px;
  padding: 1px 5px;
  font-size: 11px;
}

/* ---------- 页脚 / 提示 ---------- */
.foot {
  text-align: center;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--ink-soft);
  border-top: 2px solid var(--line);
  background: var(--paper-2);
}

.foot p { margin: 4px 0; }

.foot-dim { opacity: .7; }

#flash {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(8px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  padding: 9px 14px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 10;
}

#flash.is-show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
