:root {
  --fg: #111;
  --muted: #6b6b6b;
  --line: #e2e2e2;
  --bg: #fff;
  --like: #15803d;
  --nope: #b91c1c;
  --hold: #a16207;
  color-scheme: light;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

main {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

section { display: flex; flex-direction: column; gap: 14px; flex: 1; }
section[hidden] { display: none; }

h1 { font-size: 22px; margin: 8px 0 0; }
h2 { font-size: 17px; margin: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lead { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
a { color: inherit; }

.field { display: flex; flex-direction: column; gap: 4px; }
.field > span { font-size: 13px; color: var(--muted); }
input, textarea {
  font: inherit;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #fff;
  color: var(--fg);
}
textarea { resize: vertical; }
input:focus, textarea:focus { outline: 2px solid #111; outline-offset: -1px; }

.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.row.center { justify-content: center; }

button, .ghost-link {
  font: inherit;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--fg);
  border-radius: 6px;
  padding: 10px 16px;
  cursor: pointer;
  text-decoration: none;
  touch-action: manipulation;
}
button:disabled { opacity: .4; cursor: default; }
button.primary { background: #111; border-color: #111; color: #fff; }
button.ghost, .ghost-link { border-color: transparent; color: var(--muted); padding: 8px 10px; }
button.ghost:not(:disabled):hover, .ghost-link:hover { color: var(--fg); }

.bar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-height: 28px; }

/* カード */
.stack {
  position: relative;
  flex: 1;
  min-height: 300px;
  max-height: 520px;
}
.card {
  position: absolute;
  inset: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  text-align: center;
  font-size: clamp(22px, 7vw, 34px);
  font-weight: 600;
  line-height: 1.35;
  word-break: break-word;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  cursor: grab;
  will-change: transform;
}
.card.dragging { cursor: grabbing; }
.card.under {
  transform: scale(.96) translateY(10px);
  color: #bbb;
  pointer-events: none;
}
.card.anim { transition: transform .22s ease-out, opacity .22s ease-out; }

.stamp {
  position: absolute;
  top: 18px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 4px 10px;
  border: 2px solid currentColor;
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
}
.stamp.like { left: 18px; color: var(--like); }
.stamp.nope { right: 18px; color: var(--nope); }
.stamp.hold { left: 50%; top: auto; bottom: 18px; transform: translateX(-50%); color: var(--hold); }

.empty { color: var(--muted); display: flex; align-items: center; justify-content: center; height: 100%; }

/* 操作ボタン */
.actions { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.act { padding: 14px 8px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; }
.act .key { font-weight: 400; color: var(--muted); }
.act.like { color: var(--like); }
.act.nope { color: var(--nope); }
.act.hold { color: var(--hold); }

/* 結果 */
.group { border-top: 1px solid var(--line); padding-top: 10px; }
.group h3 { font-size: 14px; margin: 0 0 6px; display: flex; gap: 8px; align-items: baseline; }
.group h3 .n { color: var(--muted); font-weight: 400; }
.group.like h3 { color: var(--like); }
.group.nope h3 { color: var(--nope); }
.group.hold h3 { color: var(--hold); }
.group ul { margin: 0; padding-left: 1.2em; }
.group .none { color: var(--muted); margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: #111;
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 14px;
}
