:root {
  --bg: #f3ead8;
  --ink: #3a2a22;
  --ink-dim: #7a6558;
  --pill: rgba(255, 250, 242, 0.78);
  --pill-active: #3a2a22;
  --pill-active-ink: #fff8ef;
  --shadow: 0 8px 24px rgba(80, 50, 30, 0.12);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
}

canvas#c {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  cursor: pointer;
}

#ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--safe-t) + 12px) 16px calc(var(--safe-b) + 16px);
  z-index: 2;
}

header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
header h1 {
  margin: 0;
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--ink);
  opacity: 0.78;
  text-shadow: 0 1px 0 rgba(255,255,255,0.65);
}

#picker, #feels {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  pointer-events: auto;
}
#picker { margin-top: 6px; }
#feels { margin-top: 0; }

#picker button, #feels button, #reset, #bag {
  pointer-events: auto;
  appearance: none;
  border: none;
  margin: 0;
  font: inherit;
  cursor: pointer;
  background: var(--pill);
  color: var(--ink);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: background 0.18s ease, color 0.18s ease, transform 0.12s ease;
}

#picker button.active, #feels button.active, #bag.active {
  background: var(--pill-active);
  color: var(--pill-active-ink);
}

#picker button:active, #feels button:active, #reset:active, #bag:active {
  transform: scale(0.97);
}

footer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

#hint {
  margin: 0;
  font-size: 12px;
  color: var(--ink-dim);
  letter-spacing: 0.12em;
  text-shadow: 0 1px 0 rgba(255,255,255,0.6);
  min-height: 1.2em;
  transition: opacity 0.4s ease;
}

#hint.gone { opacity: 0; }

#reset, #bag {
  padding: 10px 22px;
  font-size: 14px;
}
.foot-row {
  display: flex;
  gap: 10px;
  align-items: center;
  pointer-events: auto;
}
#picker button, #feels button {
  padding: 7px 11px;
  font-size: 12px;
}

#splash {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  z-index: 5;
  transition: opacity 0.45s ease;
  pointer-events: none;
  color: var(--ink-dim);
  letter-spacing: 0.18em;
  font-size: 13px;
}

#splash.hide {
  opacity: 0;
}

@media (min-width: 720px) {
  #picker button, #feels button { font-size: 14px; padding: 9px 18px; }
  header h1 { font-size: 16px; }
}
