:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --ink: #1d2528;
  --muted: #687176;
  --line: #dce2e5;
  --green: #2f7d5b;
  --green-deep: #1f5f45;
  --amber: #c77b24;
  --coral: #c65345;
  --blue: #386f9e;
  --shadow: 0 12px 32px rgba(29, 37, 40, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Yu Gothic UI", "Meiryo", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(47, 125, 91, 0.1) 0, rgba(47, 125, 91, 0) 220px),
    var(--bg);
  overflow-x: hidden;
}

button,
input {
  font: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(47, 125, 91, 0.34);
  outline-offset: 3px;
}

main,
section,
article,
button {
  min-width: 0;
}

.app-shell {
  width: 100%;
  max-width: 760px;
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
}

.topbar {
  display: grid;
  grid-template-columns: 48px 1fr 44px;
  gap: 12px;
  align-items: center;
  margin-bottom: 18px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  color: var(--green);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.brand-mark svg {
  width: 31px;
  height: 31px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--green-deep);
  font-size: 0.78rem;
  font-weight: 700;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.icon-button,
.quiet-button,
.action-button,
.add-point-button,
.primary-button,
.mini-button,
.sample-button,
.add-custom-button {
  cursor: pointer;
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--green-deep);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.icon-button svg,
.quiet-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(106px, 0.6fr) 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
  color: #ffffff;
  background:
    linear-gradient(135deg, rgba(47, 125, 91, 0.96), rgba(56, 111, 158, 0.94)),
    var(--green);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.intro-card {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(246, 247, 249, 0.92)),
    var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: 8px;
  box-shadow: 0 8px 22px rgba(29, 37, 40, 0.08);
}

.intro-card[hidden] {
  display: none;
}

.intro-card h2 {
  margin: 0 0 8px;
  font-size: 1.12rem;
  line-height: 1.3;
  letter-spacing: 0;
}

.intro-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.intro-card .intro-safety {
  margin-top: 8px;
  color: var(--ink);
  font-weight: 800;
}

.intro-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hero-panel > *,
.action-button > *,
.stat-card > *,
.history-item > * {
  min-width: 0;
}

.hero-panel .eyebrow {
  color: rgba(255, 255, 255, 0.78);
}

.hero-panel h2 {
  margin: 0;
  font-size: clamp(3.6rem, 16vw, 5.8rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero-panel h2 small {
  margin-left: 6px;
  font-size: 1.05rem;
  font-weight: 700;
}

.phrase {
  margin: 0;
  font-size: clamp(1rem, 4vw, 1.25rem);
  font-weight: 700;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0 20px;
}

.stat-card {
  min-height: 86px;
  padding: 14px 10px;
  text-align: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.stat-card span {
  display: block;
  min-height: 34px;
  font-size: 1.8rem;
  font-weight: 800;
  line-height: 1;
}

.stat-card p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.growth-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin: -6px 0 18px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid rgba(56, 111, 158, 0.2);
  border-radius: 8px;
  box-shadow: 0 5px 16px rgba(29, 37, 40, 0.06);
}

.growth-card[hidden] {
  display: none;
}

.growth-card h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.02rem;
  line-height: 1.35;
  letter-spacing: 0;
}

.growth-card p {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  line-height: 1.5;
}

.growth-metric {
  display: grid;
  justify-items: end;
  min-width: 82px;
}

.growth-metric span {
  color: var(--blue);
  font-size: 1.7rem;
  font-weight: 850;
  line-height: 1;
}

.growth-metric small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
  white-space: nowrap;
}

.section-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 20px 0 10px;
}

.section-heading h2 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.section-heading.compact {
  margin-top: 0;
}

.quiet-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  color: var(--green-deep);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
}

.quiet-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.quiet-button.danger {
  color: var(--coral);
}

.primary-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  color: #ffffff;
  background: var(--green);
  border: 0;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 850;
}

.safety-strip {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  margin: -6px 0 20px;
  padding: 10px 12px;
  background: #fff8ef;
  border: 1px solid rgba(199, 123, 36, 0.28);
  border-radius: 8px;
}

.notice-icon {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #ffffff;
  background: var(--amber);
  border-radius: 8px;
}

.notice-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.safety-strip p {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.45;
}

.safety-strip strong {
  color: var(--ink);
}

.focus-card {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 14px;
  background: var(--panel);
  border: 1px solid rgba(47, 125, 91, 0.24);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(29, 37, 40, 0.08);
}

.focus-card[hidden] {
  display: none;
}

.focus-copy {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
}

.focus-card[data-tone="amber"] .focus-icon {
  background: var(--amber);
}

.focus-card[data-tone="blue"] .focus-icon {
  background: var(--blue);
}

.focus-card[data-tone="coral"] .focus-icon {
  background: var(--coral);
}

.focus-card h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1.12rem;
  line-height: 1.32;
  letter-spacing: 0;
}

.focus-card p {
  margin: 3px 0 0;
}

.focus-card #focusPhrase {
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 0.86rem;
  line-height: 1.5;
}

.focus-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.toku-grid {
  display: grid;
  gap: 10px;
}

.toku-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(29, 37, 40, 0.06);
}

.toku-copy {
  display: grid;
  min-width: 0;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  align-items: center;
}

.toku-icon,
.sample-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--panel);
  background: var(--green);
  border-radius: 8px;
}

.toku-card[data-tone="amber"] .toku-icon {
  background: var(--amber);
}

.toku-card[data-tone="blue"] .toku-icon {
  background: var(--blue);
}

.toku-card[data-tone="coral"] .toku-icon {
  background: var(--coral);
}

.toku-icon svg,
.sample-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.toku-copy h3 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 1rem;
  line-height: 1.35;
}

.toku-title-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.toku-badge {
  display: inline-flex;
  min-height: 20px;
  align-items: center;
  padding: 0 7px;
  color: var(--green-deep);
  background: #eff7f2;
  border: 1px solid rgba(47, 125, 91, 0.18);
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 850;
  line-height: 1;
}

.toku-badge[hidden] {
  display: none;
}

.toku-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 0.82rem;
  line-height: 1.45;
}

.toku-meter {
  display: grid;
  justify-items: end;
  min-width: 74px;
}

.toku-meter span {
  font-size: 2rem;
  font-weight: 850;
  line-height: 1;
}

.toku-meter small {
  margin-top: 5px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  text-align: right;
  white-space: nowrap;
}

.toku-controls {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: 1fr 44px;
  gap: 8px;
}

.add-point-button,
.add-custom-button {
  min-height: 44px;
  color: #ffffff;
  background: var(--green);
  border: 0;
  border-radius: 8px;
  font-size: 1.06rem;
  font-weight: 850;
}

.mini-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  color: var(--coral);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.mini-button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-panel {
  margin-top: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.76);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.custom-maker {
  display: grid;
  gap: 10px;
}

.sample-area {
  margin-top: 16px;
}

.sample-area h3 {
  margin: 0 0 10px;
  font-size: 0.98rem;
}

.sample-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 10px;
}

.filter-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 800;
}

.filter-button[aria-pressed="true"] {
  color: #ffffff;
  background: var(--green);
  border-color: var(--green);
}

.sample-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}

.sample-button {
  display: grid;
  grid-template-columns: 38px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 9px;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.sample-button:disabled {
  cursor: default;
  opacity: 0.54;
}

.sample-button strong,
.sample-button small {
  display: block;
  overflow-wrap: anywhere;
}

.sample-button strong {
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.35;
}

.sample-button small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-button {
  display: grid;
  width: 100%;
  min-width: 0;
  min-height: 112px;
  grid-template-rows: 38px 1fr;
  gap: 10px;
  align-items: center;
  padding: 16px 12px 14px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(29, 37, 40, 0.06);
}

.action-button:active {
  transform: translateY(1px);
}

.action-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  margin: 0 auto;
  color: var(--panel);
  background: var(--green);
  border-radius: 8px;
}

.action-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-button[data-tone="amber"] .action-icon {
  background: var(--amber);
}

.action-button[data-tone="blue"] .action-icon {
  background: var(--blue);
}

.action-button[data-tone="coral"] .action-icon {
  background: var(--coral);
}

.action-text {
  display: block;
  min-height: 42px;
  text-align: center;
  font-size: clamp(0.93rem, 3.6vw, 1.02rem);
  font-weight: 800;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.entry-options {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.toggle-row,
.note-field {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.toggle-row {
  grid-template-columns: 24px 1fr;
  align-items: center;
  color: var(--ink);
  font-weight: 700;
}

.toggle-row input {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}

.note-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.note-field input {
  width: 100%;
  min-height: 42px;
  padding: 0 11px;
  color: var(--ink);
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.history-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history-item {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.history-item .mini-icon {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  color: #ffffff;
  background: var(--green);
  border-radius: 8px;
}

.history-item .mini-icon svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.history-main {
  min-width: 0;
}

.history-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.94rem;
}

.history-main small {
  display: block;
  margin-top: 3px;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-time {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
}

.celebration-toast {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 20;
  width: min(360px, calc(100vw - 32px));
  padding: 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(47, 125, 91, 0.28);
  border-radius: 8px;
  box-shadow: 0 18px 46px rgba(29, 37, 40, 0.2);
  animation: toast-in 180ms ease-out;
}

.celebration-toast[hidden] {
  display: none;
}

.celebration-toast strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.3;
}

.celebration-toast p {
  margin: 5px 0 10px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.celebration-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.celebration-chips button {
  min-height: 32px;
  padding: 0 10px;
  color: var(--green-deep);
  background: #eff7f2;
  border: 1px solid rgba(47, 125, 91, 0.22);
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.empty-state {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  background: var(--panel);
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.ad-panel {
  display: grid;
  gap: 6px;
  min-height: 92px;
  margin: 18px 0 0;
  padding: 10px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.ad-panel[hidden] {
  display: none;
}

.ad-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1;
}

.ad-unit {
  display: block;
  min-width: 250px;
  min-height: 70px;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
  justify-content: center;
  margin-top: 26px;
  color: var(--muted);
  font-size: 0.82rem;
}

.app-footer p {
  margin: 0;
}

.app-footer a,
.info-content a {
  color: var(--green-deep);
  font-weight: 700;
  text-decoration: none;
}

.info-page .topbar {
  grid-template-columns: 44px 1fr;
}

.info-content {
  display: grid;
  gap: 12px;
}

.info-content section {
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.info-content h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  line-height: 1.3;
}

.info-content p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

@media (min-width: 680px) {
  .app-shell {
    padding-top: 30px;
  }

  .toku-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .custom-maker {
    grid-template-columns: 1fr 1.3fr;
    align-items: stretch;
  }

  .intro-card {
    grid-template-columns: 1fr 210px;
    align-items: center;
  }

  .focus-card {
    grid-template-columns: 1fr 230px;
    align-items: center;
  }

  .add-custom-button {
    grid-column: 1 / -1;
  }
}

@media (max-width: 390px) {
  .topbar {
    grid-template-columns: 44px 1fr 40px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .hero-panel {
    grid-template-columns: 1fr;
  }

  .intro-actions {
    grid-template-columns: 1fr;
  }

  .focus-actions {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    gap: 7px;
  }

  .stat-card {
    padding-right: 6px;
    padding-left: 6px;
  }

  .history-item {
    grid-template-columns: 38px 1fr;
  }

  .history-time {
    grid-column: 2;
  }

  .growth-card {
    grid-template-columns: 1fr;
  }

  .growth-metric {
    justify-items: start;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
}
