:root {
  color-scheme: light;
  --bg: #efe6d6;
  --ink: #1c1712;
  --muted: #6d6256;
  --card: #fffaf3;
  --line: #ddcbb6;
  --accent: #0f6b45;
  --accent-ink: #f4fff8;
  --bar: #0f6b45;
  --xp: #9a5b12;
  --soft: #f3eadc;
  --shadow: 0 16px 40px rgba(68, 42, 16, 0.08);
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
  --body: "Outfit", "Noto Sans JP", "Hiragino Sans", sans-serif;
  --radius: 18px;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(255, 255, 255, 0.7), transparent 50%),
    var(--bg);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.45;
}
button, input, select { font: inherit; color: inherit; }
button, a { cursor: pointer; }
h1, h2, h3, p { margin: 0; }
h2 { font-family: var(--display); font-size: 2rem; font-weight: 560; letter-spacing: -0.03em; }
h3 { font-size: 0.95rem; margin-top: 1.1rem; }

.dash, main { width: min(980px, calc(100% - 2rem)); margin: 0 auto; }
.chrome { padding: 1.4rem 0 0.4rem; display: grid; gap: 0.8rem; }
.kicker { font-family: var(--display); font-size: 1.7rem; letter-spacing: -0.03em; }
.sample, .fine, .hint, .who { color: var(--muted); font-size: 0.86rem; }
.who-line { margin: 0.6rem 0 1rem; color: var(--muted); }
nav { display: flex; gap: 0.5rem; }
nav a, button, .controls select, .controls input {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  text-decoration: none;
  color: inherit;
}
nav a[aria-current="page"], button[aria-pressed="true"] { background: var(--ink); color: var(--card); border-color: var(--ink); }
.controls { display: flex; flex-wrap: wrap; gap: 0.45rem; align-items: end; }
.controls label, .stack label, .record label { display: grid; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); }
.controls select, .stack input, .stack select, .record input, .inline input, .inline select {
  border: 1px solid var(--line);
  background: var(--card);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  min-width: 0;
}
.block {
  position: relative;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.15rem 1.25rem;
  margin: 0 0 1rem;
}
.goals { padding-top: 1.3rem; }
.goals h2 { font-size: 2.4rem; }
.nudge { position: absolute; top: 0.8rem; right: 0.8rem; display: flex; gap: 0.25rem; }
.nudge button { padding: 0.15rem 0.45rem; }
.goal { margin-top: 1rem; }
.goal header { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; }
.goal h3 { font-family: var(--display); font-size: 1.45rem; margin: 0; }
.figures { margin: 0.2rem 0 0.45rem; }
.done { color: var(--accent); font-style: normal; font-size: 0.8rem; }
.bar { height: 14px; background: var(--soft); border-radius: 999px; overflow: hidden; }
.goals .bar { height: 18px; }
.bar span { display: block; height: 100%; width: 0; background: var(--bar); border-radius: inherit; transition: width 0.45s ease; }
.xp .bar span { background: var(--xp); }
.xp-total { display: flex; align-items: baseline; gap: 0.7rem; margin: 0.4rem 0; }
.xp-total strong { font-family: var(--display); font-size: 3rem; letter-spacing: -0.04em; line-height: 1; }
.xp-head { display: flex; }
.stack, .record { display: grid; gap: 0.65rem; margin-top: 1rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.split, .actions, .inline, .row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: end; }
.stack button, .record button, .inline button, .row-actions button {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}
.check { display: flex !important; grid-template-columns: auto 1fr; align-items: center; gap: 0.45rem; color: var(--ink) !important; }
.board ol, .recent, .badges, .kpis ul, .xp-list { list-style: none; padding: 0; margin: 0.4rem 0 0; }
.board li, .xp-list li { display: grid; grid-template-columns: 2rem 1fr auto; gap: 0.6rem; align-items: center; padding: 0.45rem 0; border-bottom: 1px solid var(--line); }
.who { position: relative; display: block; min-height: 1.45rem; border-radius: 4px; overflow: hidden; }
.who .meter { position: absolute; left: 0; top: 0; bottom: 0; background: color-mix(in srgb, var(--accent) 32%, transparent); border-radius: 4px; }
.who > span { position: relative; z-index: 1; display: block; padding: 0.12rem 0.35rem; }
.xp-list li { grid-template-columns: 1fr auto auto; }
.xp-list .bar { grid-column: 1 / -1; height: 8px; }
.board li.self { background: var(--soft); margin: 0 -0.4rem; padding: 0.45rem; border-radius: 8px; }
.rank { font-variant-numeric: tabular-nums; color: var(--muted); }
.kpis ul { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.5rem; }
.kpis li, .badges li { background: var(--soft); border-radius: 12px; padding: 0.65rem; display: grid; gap: 0.15rem; }
.kpis strong { font-size: 1.25rem; }
.badges { display: flex; gap: 0.5rem; }
.badges li { opacity: 0.45; }
.badges li.on { opacity: 1; outline: 1px solid var(--accent); }
.slider { margin-top: 0.7rem; }
.slider input { width: 100%; accent-color: var(--accent); }
.slider strong { font-size: 1.1rem; }
.wait { color: var(--xp); }
.empty { margin-top: 0.7rem; }
#fx { position: fixed; inset: 0; pointer-events: none; }
.gain-toast, .level-banner {
  position: absolute;
  left: 50%;
  top: 18%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--card);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  animation: pop 1.3s ease forwards;
}
.level-banner {
  top: 28%;
  font-family: var(--display);
  font-size: 2.4rem;
  border-radius: 16px;
  background: var(--xp);
  color: white;
  animation: pop 2.3s ease forwards;
}
.home { width: min(720px, calc(100% - 2rem)); margin: 8vh auto; }
.home h1 { font-family: var(--display); font-size: clamp(2.6rem, 7vw, 4.4rem); letter-spacing: -0.04em; line-height: 0.95; }
.home .paths { display: grid; grid-template-columns: 1fr 1fr; gap: 0.8rem; margin-top: 1.5rem; }
.home .paths a { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 1.2rem; text-decoration: none; color: inherit; box-shadow: var(--shadow); }
.home .paths strong { display: block; font-family: var(--display); font-size: 2rem; }
@keyframes pop {
  0% { opacity: 0; transform: translateX(-50%) translateY(8px) scale(0.96); }
  15% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}
@media (max-width: 720px) {
  .kpis ul, .home .paths { grid-template-columns: 1fr 1fr; }
  .goals h2 { font-size: 2rem; }
  .xp-total strong { font-size: 2.4rem; }
}
.dash:not(.manager-dash) {
  position: sticky;
  top: 0;
  z-index: 30;
  width: 100%;
  margin: 0;
  padding: 0.75rem 0 0;
  background: var(--bg);
}
.dash:not(.manager-dash) .dash-top {
  width: min(980px, calc(100% - 2rem));
  margin: 0 auto;
}
.dash { padding: 1.1rem 0 0; }
.dash-top { display: flex; gap: 0.9rem; align-items: center; }
.manager-dash .dash-top { flex-wrap: wrap; }
.dash h1 { font-family: var(--display); font-size: 2rem; letter-spacing: -0.03em; min-width: 0; }
.level-name { font-size: 1rem; font-family: var(--body); color: var(--muted); margin-left: 0.35rem; font-weight: 500; }
.portrait { display: inline-flex; padding: 3px; border-radius: 50%; background: var(--line); line-height: 0; }
.portrait.small .avatar { width: 2.2rem; height: 2.2rem; font-size: 0.75rem; }
.portrait.tier-bronze { background: #c4844a; }
.portrait.tier-silver { background: #d5d8de; }
.portrait.tier-gold { background: #f0c14a; }
.portrait.tier-platinum { background: #7ec8d4; }
.portrait.tier-diamond { background: #8eb4ff; }
.portrait.tier-master { background: #c084fc; }
.portrait.tier-grandmaster { background: #f07167; }
.portrait.tier-champion { background: #ffe08a; }
.text-link { margin-left: auto; color: var(--ink); }
.member { padding: 0.85rem 0; border-top: 1px solid var(--line); }
.member-head { display: flex; align-items: center; gap: 0.65rem; }
.member-head h3 { margin: 0; font-size: 1.15rem; }
.rate-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.55rem 0.8rem; margin-top: 0.6rem; }
.rate, .tight label { display: grid; gap: 0.2rem; font-size: 0.86rem; color: var(--muted); }
.tight { display: flex; flex-wrap: wrap; gap: 0.55rem 0.8rem; align-items: end; margin-top: 0.8rem; }
.rate input, .tight input, .tight select { max-width: 9rem; border: 1px solid var(--line); background: var(--bg); border-radius: 10px; padding: 0.35rem 0.45rem; }
.pace { margin-left: auto; text-align: right; font-variant-numeric: tabular-nums; line-height: 1.35; }
.pace p { color: var(--ink); font-size: 0.95rem; }
.avatar {
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  border: 0;
  background: hsl(var(--hue), 46%, 36%);
  color: #fff;
  font-weight: 700;
}
.profile-wrap { position: relative; }
.profile-panel {
  position: absolute;
  z-index: 5;
  top: 3.6rem;
  left: 0;
  width: min(320px, 92vw);
  max-height: min(70vh, 34rem);
  overflow: auto;
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.profile-panel label, .sample-tools { display: grid; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); }
.profile-panel select, .lane-add input, .lane-add select, .inline input {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
}
.sample-tools { border-top: 1px solid var(--line); padding-top: 0.55rem; }
.wow {
  position: relative;
  width: 100%;
  height: 1.6rem;
  margin: 0.7rem 0 0;
  background: var(--soft);
  overflow: hidden;
}
.wow .fill { display: block; height: 100%; background: var(--xp); transition: width 0.55s ease; }
.wow em {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-style: normal;
  font-size: 0.75rem;
  pointer-events: none;
}
.wow.level-flash .fill { animation: xp-pulse 0.7s ease; }
.quests > h2, .stack-title { margin: 1.1rem 0 0.85rem; }
.lanes { display: flex; flex-direction: column; gap: 0.85rem; }
.lane {
  margin: 0;
  padding: 0.85rem 1rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.lane-today { border-top: 4px solid var(--accent); }
.lane-week { border-top: 4px solid var(--xp); }
.lane-month { border-top: 4px solid var(--muted); }
.lane-quarter { border-top: 4px solid var(--line); }
.lane-team { border-top: 4px solid var(--accent); }
.lane h2 { font-size: 1.35rem; }
.wow em span {
  background: color-mix(in srgb, var(--card) 88%, transparent);
  border-radius: 999px;
  padding: 0.05rem 0.5rem;
}
.lane-add { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.65rem; }
.lane-add input[name="title"] { flex: 1 1 12rem; }
.lane-head { display: flex; align-items: center; gap: 0.75rem; }
.lane-head h2 { margin: 0; }
.lane-head button, .goal header .row-actions button {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
}
.goal header { align-items: center; }
.goal header h3 { flex: 1; }
.goal header .row-actions { flex-wrap: nowrap; margin-left: auto; }
.confirm-back {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(28, 23, 18, 0.35);
}
.confirm {
  width: min(420px, 100%);
  display: grid;
  gap: 0.7rem;
  padding: 1.1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.confirm label { display: grid; gap: 0.25rem; font-size: 0.82rem; color: var(--muted); }
.done-row { margin-top: 0.55rem; }
.goal.is-done {
  margin-top: 0.8rem;
  padding: 0.55rem 0.7rem;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 12%, var(--card));
}
.goal.just-reported { animation: quest-pulse 0.45s ease; }
.goal.just-done { animation: quest-complete 0.7s ease; }
.xp-float {
  position: absolute;
  right: 0.8rem;
  top: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--xp);
  animation: xp-rise 0.9s ease forwards;
  pointer-events: none;
}
@keyframes quest-pulse {
  0% { transform: translateX(0); }
  40% { transform: translateX(4px); }
  100% { transform: translateX(0); }
}
@keyframes quest-complete {
  0% { transform: scale(1); }
  40% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
@keyframes xp-rise {
  0% { opacity: 0; transform: translateY(6px); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-16px); }
}
@keyframes xp-pulse {
  0% { filter: brightness(1); }
  40% { filter: brightness(1.8); }
  100% { filter: brightness(1); }
}
@media (prefers-reduced-motion: reduce) {
  .bar span, .wow .fill, .gain-toast, .level-banner, .goal.just-reported, .goal.just-done, .xp-float { transition: none; animation: none; }
}
.section-cards { display: grid; gap: 0.35rem; }
.section-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  border-radius: 10px;
  padding: 0.45rem 0.55rem;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.section-card input { width: 1.05rem; height: 1.05rem; margin: 0; accent-color: var(--accent); cursor: pointer; }
.section-card.is-off span { color: var(--muted); }
.section-card.is-dragging { opacity: 0.45; }

html[data-theme="paper"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #12160f;
  --ink: #edf6df;
  --muted: #a8b89a;
  --card: #1b2316;
  --line: #314028;
  --accent: #d6ff4a;
  --accent-ink: #15200a;
  --bar: #d6ff4a;
  --xp: #7dffb2;
  --soft: #24301c;
  --shadow: none;
  --display: "Oxanium", "Noto Sans JP", sans-serif;
  --body: "Outfit", "Noto Sans JP", sans-serif;
}
html[data-theme="grove"][data-mode="light"] {
  color-scheme: light;
  --bg: #e7f0e4;
  --ink: #142117;
  --muted: #5c6b5e;
  --card: #f7fbf6;
  --line: #c5d7c4;
  --accent: #2f6b45;
  --accent-ink: #f4fff8;
  --bar: #2f6b45;
  --xp: #8a6a12;
  --soft: #e3eee2;
  --shadow: 0 16px 40px rgba(20, 48, 28, 0.08);
  --display: "Outfit", "Noto Sans JP", sans-serif;
}
html[data-theme="grove"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #101712;
  --ink: #e7f3e4;
  --muted: #9bb39a;
  --card: #18241b;
  --line: #2c4332;
  --accent: #8dce7a;
  --accent-ink: #10200f;
  --bar: #8dce7a;
  --xp: #e2c56a;
  --soft: #223028;
  --shadow: none;
  --display: "Outfit", "Noto Sans JP", sans-serif;
}
html[data-theme="tide"][data-mode="light"] {
  color-scheme: light;
  --bg: #e6eef6;
  --ink: #12202c;
  --muted: #5c6d7c;
  --card: #f6fafd;
  --line: #c5d4e4;
  --accent: #1d5f8a;
  --accent-ink: #f4fbff;
  --bar: #1d5f8a;
  --xp: #0e7c86;
  --soft: #e1ebf4;
  --shadow: 0 16px 40px rgba(16, 40, 64, 0.08);
  --display: "Outfit", "Noto Sans JP", sans-serif;
}
html[data-theme="tide"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #0e1620;
  --ink: #e6f1fb;
  --muted: #9aafc2;
  --card: #162230;
  --line: #2a4158;
  --accent: #7ec8ff;
  --accent-ink: #082033;
  --bar: #7ec8ff;
  --xp: #6ee0d0;
  --soft: #1c2e40;
  --shadow: none;
  --display: "Outfit", "Noto Sans JP", sans-serif;
}
html[data-theme="ember"][data-mode="light"] {
  color-scheme: light;
  --bg: #f6ebe3;
  --ink: #2a160f;
  --muted: #7a5c50;
  --card: #fff8f3;
  --line: #e6cfc2;
  --accent: #b8431f;
  --accent-ink: #fff7f2;
  --bar: #b8431f;
  --xp: #c4841d;
  --soft: #f3e4d8;
  --shadow: 0 16px 40px rgba(90, 36, 12, 0.08);
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
}
html[data-theme="ember"][data-mode="dark"] {
  color-scheme: dark;
  --bg: #1a1210;
  --ink: #f8ece4;
  --muted: #c4a89a;
  --card: #271c18;
  --line: #4a342c;
  --accent: #ff8a4c;
  --accent-ink: #2a1208;
  --bar: #ff8a4c;
  --xp: #ffc56a;
  --soft: #32241e;
  --shadow: none;
  --display: "Newsreader", "Iowan Old Style", Georgia, serif;
}
html[data-mode="dark"] body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 10%, transparent), transparent 220px),
    var(--bg);
}
html[data-mode="dark"] .avatar { color: #10160c; }
