:root {
  --bg: #f8f5ef;
  --paper: rgba(255, 255, 255, 0.7);
  --paper-strong: rgba(255, 255, 255, 0.9);
  --text: #3f3a35;
  --muted: #7a736a;
  --line: rgba(127, 169, 155, 0.24);
  --shadow: 0 22px 60px rgba(79, 116, 107, 0.15);
  --radius-lg: 24px;
  --radius-md: 18px;
  --theme-bg: linear-gradient(135deg, #f8f5ef 0%, #eef6f1 46%, #e8f0f7 100%);
  --theme-ink: #334a48;
  --theme-soft: rgba(255, 255, 255, 0.5);
  --accent: #7fa99b;
  --surface-gradient: linear-gradient(145deg, rgba(255, 255, 255, 0.9) 0%, rgba(248, 245, 239, 0.78) 45%, rgba(226, 239, 232, 0.62) 100%);
  --surface-gradient-soft: linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(232, 240, 247, 0.42));
  --font-body: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
  --font-rounded: "Hiragino Maru Gothic ProN", "Hiragino Maru Gothic Pro", "Yu Gothic", "Noto Sans JP", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--theme-bg);
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(90deg, rgba(248, 245, 239, 0.1), rgba(248, 245, 239, 0.36)),
    url("../assets/background-window-rain.png") top center / cover fixed no-repeat,
    linear-gradient(118deg, rgba(127, 169, 155, 0.22) 0%, transparent 34%, rgba(242, 184, 128, 0.16) 74%, transparent 100%),
    radial-gradient(circle at 18% 8%, rgba(255, 255, 255, 0.72), transparent 30%),
    radial-gradient(circle at 88% 18%, rgba(191, 219, 254, 0.18), transparent 32%),
    var(--theme-bg);
  font-family: var(--font-body);
  line-height: 1.7;
  transition: background 0.35s ease;
}

body::before {
  content: none;
}

body::after {
  content: none;
}

.app-shell,
.legal-shell,
.site-footer {
  position: relative;
  z-index: 1;
}

body.theme-calm_blue {
  --theme-bg: linear-gradient(135deg, #f8f5ef 0%, #eef6f1 46%, #e8f0f7 100%);
  --theme-ink: #334a48;
  --accent: #7fa99b;
  --surface-gradient: linear-gradient(145deg, rgba(255, 255, 255, 0.92) 0%, rgba(248, 245, 239, 0.78) 46%, rgba(226, 239, 232, 0.62) 100%);
  --surface-gradient-soft: linear-gradient(145deg, rgba(255, 255, 255, 0.74), rgba(232, 240, 247, 0.42));
}

body.theme-warm_orange {
  --theme-bg: linear-gradient(135deg, #fff1e6, #ffe0b2);
  --theme-ink: #6f3e12;
  --accent: #f97316;
}

body.theme-night_purple {
  --theme-bg: linear-gradient(135deg, #312e81, #7c3aed);
  --theme-ink: #f8fafc;
  --text: #f8fafc;
  --muted: rgba(255, 255, 255, 0.74);
  --line: rgba(255, 255, 255, 0.22);
  --paper: rgba(17, 24, 39, 0.46);
  --paper-strong: rgba(17, 24, 39, 0.62);
  --accent: #c4b5fd;
}

body.theme-forest_green {
  --theme-bg: linear-gradient(135deg, #d1fae5, #bbf7d0);
  --theme-ink: #14532d;
  --accent: #16a34a;
}

body.theme-rain_gray {
  --theme-bg: linear-gradient(135deg, #e5e7eb, #cbd5e1);
  --theme-ink: #334155;
  --accent: #64748b;
}

body.theme-sunset_pink {
  --theme-bg: linear-gradient(135deg, #ffe4e6, #fbcfe8);
  --theme-ink: #7f1d46;
  --accent: #ec4899;
}

button,
input,
textarea {
  font: inherit;
}

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

.app-shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 44px 0 72px;
}

.hero {
  padding: 24px 4px 30px;
  color: var(--theme-ink);
}

.eyebrow {
  font-family: var(--font-rounded);
  margin: 0 0 12px;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

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

h1 {
  font-family: var(--font-rounded);
  margin-bottom: 16px;
  font-size: clamp(2.2rem, 7vw, 4.9rem);
  line-height: 1.05;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.hero-copy {
  max-width: 650px;
  margin-bottom: 0;
  font-size: 1.08rem;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.mobile-break {
  display: none;
}

.panel,
.result-card,
.share-panel,
.safety-note {
  border: 1px solid var(--line);
  background: var(--surface-gradient);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--radius-lg);
  padding: clamp(22px, 4vw, 38px);
}

.panel::before,
.share-panel::before,
.safety-note::before,
.legal-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(122deg, rgba(127, 169, 155, 0.12), transparent 38%),
    linear-gradient(315deg, rgba(242, 184, 128, 0.1), transparent 44%);
}

.panel-heading {
  margin-bottom: 28px;
}

.step-label {
  font-family: var(--font-rounded);
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
}

.panel-heading h2,
.share-panel h2 {
  font-family: var(--font-rounded);
  margin-bottom: 0;
  font-size: clamp(1.35rem, 4vw, 2rem);
  color: var(--theme-ink);
}

form {
  display: grid;
  gap: 26px;
}

fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

legend,
.text-label {
  font-family: var(--font-rounded);
  display: block;
  margin-bottom: 12px;
  color: var(--theme-ink);
  font-weight: 800;
}

legend span,
.text-label span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

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

.choice-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.choice-grid label {
  display: block;
  cursor: pointer;
}

.choice-grid input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.choice-grid span {
  font-family: var(--font-rounded);
  display: flex;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 10px 14px;
  background: var(--surface-gradient-soft);
  color: var(--theme-ink);
  font-weight: 800;
  text-align: center;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.choice-grid input:checked + span {
  border-color: color-mix(in srgb, var(--accent), white 18%);
  background: linear-gradient(145deg, rgba(232, 245, 238, 0.92), rgba(255, 246, 232, 0.72));
  transform: translateY(-1px);
}

.choice-grid input:focus-visible + span,
button:focus-visible,
textarea:focus-visible,
input[type="range"]:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent), white 40%);
  outline-offset: 3px;
}

.fatigue-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.fatigue-text,
.note-help {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(248, 245, 239, 0.68));
  color: var(--text);
}

.primary-button,
.secondary-button {
  font-family: var(--font-rounded);
  min-height: 52px;
  border: 0;
  border-radius: 18px;
  padding: 13px 22px;
  cursor: pointer;
  font-weight: 900;
  transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.primary-button {
  width: 100%;
  background: linear-gradient(135deg, #6f9b8e, #8fb8aa);
  color: #fff;
  box-shadow: 0 16px 34px rgba(79, 116, 107, 0.24);
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-1px);
}

.primary-button[disabled] {
  cursor: wait;
  opacity: 0.72;
  transform: none;
}

.button-loading,
.is-loading .button-idle {
  display: none;
}

.is-loading .button-loading {
  display: inline;
}

.message {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.message.error {
  border: 1px solid rgba(239, 68, 68, 0.24);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(254, 226, 226, 0.74);
  color: #991b1b;
}

.result-wrap {
  margin-top: 34px;
}

.result-card {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-lg);
  padding: clamp(26px, 5vw, 46px);
  color: var(--theme-ink);
}

.result-card::before,
.share-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--card-gradient);
}

.calm_blue { --card-gradient: linear-gradient(135deg, #f8f5ef, #e8f0f7); --theme-card-ink: #334a48; }
.warm_orange { --card-gradient: linear-gradient(135deg, #fff1e6, #ffe0b2); --theme-card-ink: #6f3e12; }
.night_purple { --card-gradient: linear-gradient(135deg, #312e81, #7c3aed); --theme-card-ink: #f8fafc; }
.forest_green { --card-gradient: linear-gradient(135deg, #d1fae5, #bbf7d0); --theme-card-ink: #14532d; }
.rain_gray { --card-gradient: linear-gradient(135deg, #e5e7eb, #cbd5e1); --theme-card-ink: #334155; }
.sunset_pink { --card-gradient: linear-gradient(135deg, #ffe4e6, #fbcfe8); --theme-card-ink: #7f1d46; }

.result-topline {
  font-family: var(--font-rounded);
  margin-bottom: 8px;
  color: color-mix(in srgb, var(--theme-card-ink), transparent 25%);
  font-size: 0.82rem;
  font-weight: 900;
}

.result-card h2 {
  font-family: var(--font-rounded);
  margin-bottom: 16px;
  color: var(--theme-card-ink);
  font-size: clamp(1.7rem, 5vw, 3rem);
  line-height: 1.18;
}

.main-message {
  max-width: 720px;
  margin-bottom: 28px;
  color: var(--theme-card-ink);
  font-size: clamp(1.1rem, 3vw, 1.45rem);
  font-weight: 800;
}

.result-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.result-list div {
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.46);
}

.night_purple .result-list div {
  background: rgba(255, 255, 255, 0.14);
}

.result-list span {
  display: block;
  margin-bottom: 8px;
  color: color-mix(in srgb, var(--theme-card-ink), transparent 26%);
  font-size: 0.76rem;
  font-weight: 900;
}

.result-list p,
.nuko-comment {
  margin-bottom: 0;
  color: var(--theme-card-ink);
  font-weight: 800;
}

.nuko-comment {
  margin-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.5);
  padding-top: 20px;
  font-size: 1.08rem;
}

.safety-alert {
  margin-top: 18px;
  border: 1px solid rgba(220, 38, 38, 0.24);
  border-radius: 20px;
  padding: 18px;
  background: rgba(254, 242, 242, 0.88);
  color: #7f1d1d;
  font-weight: 800;
}

.share-panel {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  margin-top: 18px;
  border-radius: var(--radius-lg);
  padding: 24px;
}

.share-panel p {
  margin-bottom: 18px;
  color: var(--muted);
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.secondary-button {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(232, 239, 232, 0.74));
  color: var(--theme-ink);
}

.secondary-button.dark {
  background: #334a48;
  color: #fff;
}

.safety-note {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  margin-top: 26px;
  border-radius: 20px;
  padding: 18px 20px;
}

.safety-note p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

.site-footer {
  width: min(960px, calc(100% - 32px));
  margin: -38px auto 0;
  padding: 0 0 44px;
  color: var(--muted);
  text-align: center;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 18px;
  margin-bottom: 12px;
}

.footer-nav a {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--theme-ink);
}

.site-footer p {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
}

.legal-shell {
  width: min(900px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0 72px;
}

.simple-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 4px 26px;
}

.brand-link,
.back-link {
  font-family: var(--font-rounded);
  color: var(--theme-ink);
  font-weight: 900;
  text-decoration: none;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
}

.brand-mark {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.84), rgba(226, 239, 232, 0.62));
}

.back-link {
  font-size: 0.9rem;
}

.legal-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(24px, 5vw, 44px);
  background: var(--surface-gradient);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.legal-card h1 {
  font-family: var(--font-rounded);
  margin-bottom: 12px;
  color: var(--theme-ink);
  font-size: clamp(2rem, 7vw, 3.6rem);
}

.legal-lead {
  margin-bottom: 30px;
  color: var(--muted);
  font-weight: 700;
}

.legal-card section {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-top: 22px;
}

.legal-card h2 {
  font-family: var(--font-rounded);
  margin-bottom: 8px;
  color: var(--theme-ink);
  font-size: 1.12rem;
}

.legal-card p,
.legal-card li,
.info-table {
  color: var(--text);
}

.legal-card ul {
  margin: 10px 0 0;
  padding-left: 1.25em;
}

.legal-date {
  margin-top: 28px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
}

.info-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
}

.info-table th,
.info-table td {
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
  text-align: left;
  vertical-align: top;
}

.info-table th {
  width: 32%;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.62), rgba(226, 239, 232, 0.48));
  color: var(--theme-ink);
  font-weight: 900;
}

.info-table tr:last-child th,
.info-table tr:last-child td {
  border-bottom: 0;
}

.app-list {
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.app-list a {
  display: block;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 16px;
  background: var(--surface-gradient-soft);
  color: var(--theme-ink);
  text-decoration: none;
}

.app-list strong {
  display: block;
  margin-bottom: 4px;
}

.app-list span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

#share-stage {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1200px;
  height: 630px;
  overflow: hidden;
}

.share-card {
  position: relative;
  display: flex;
  width: 1200px;
  height: 630px;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
  padding: 72px 84px;
  color: var(--theme-card-ink);
  font-family: var(--font-rounded);
}

.share-card::after {
  content: "";
  position: absolute;
  right: 62px;
  top: 58px;
  width: 96px;
  height: 96px;
  border: 4px solid currentColor;
  border-radius: 32px 32px 42px 42px;
  opacity: 0.18;
}

.share-type-label {
  margin: 0 0 14px;
  font-size: 30px;
  font-weight: 900;
  opacity: 0.7;
}

.share-card h2 {
  max-width: 860px;
  margin: 0 0 26px;
  font-size: 76px;
  line-height: 1.1;
  letter-spacing: 0;
}

.share-card > p:not(.share-type-label) {
  max-width: 900px;
  margin: 0 0 30px;
  font-size: 42px;
  font-weight: 900;
  line-height: 1.35;
}

#share-nuko {
  font-size: 32px;
  opacity: 0.82;
}

.share-brand {
  position: absolute;
  right: 72px;
  bottom: 58px;
  display: grid;
  gap: 2px;
  text-align: right;
}

.share-brand span {
  font-size: 28px;
  font-weight: 900;
}

.share-brand small {
  font-size: 22px;
  font-weight: 800;
  opacity: 0.68;
}

@media (max-width: 720px) {
  body {
    background:
      linear-gradient(90deg, rgba(248, 245, 239, 0.18), rgba(248, 245, 239, 0.5)),
      url("../assets/background-window-rain.png") top right 26% / auto 100vh fixed no-repeat,
      linear-gradient(118deg, rgba(127, 169, 155, 0.2) 0%, transparent 36%, rgba(242, 184, 128, 0.14) 76%, transparent 100%),
      var(--theme-bg);
  }

  .app-shell {
    width: min(100% - 22px, 960px);
    padding-top: 28px;
  }

  .hero {
    padding-bottom: 22px;
  }

  h1 {
    font-size: clamp(2.35rem, 11vw, 2.75rem);
  }

  .mobile-break {
    display: block;
  }

  .hero-copy {
    font-size: 0.98rem;
  }

  .legal-card h1 {
    font-size: clamp(1.75rem, 9vw, 2.25rem);
  }

  .legal-lead {
    font-size: 0.95rem;
  }

  .choice-grid,
  .choice-grid.compact,
  .result-list {
    grid-template-columns: 1fr;
  }

  .fatigue-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .fatigue-row span:last-child {
    text-align: right;
  }

  .share-actions {
    display: grid;
  }

  .secondary-button {
    width: 100%;
  }

  .site-footer {
    width: min(100% - 22px, 960px);
    margin-top: -36px;
  }

  .simple-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .info-table th,
  .info-table td {
    display: block;
    width: 100%;
  }

  .info-table th {
    border-bottom: 0;
    padding-bottom: 4px;
  }
}

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