:root {
  --bg-top: #f6efe4;
  --bg-bottom: #d8c3a5;
  --paper: rgba(255, 251, 245, 0.9);
  --paper-strong: rgba(255, 248, 238, 0.98);
  --line: rgba(72, 45, 28, 0.12);
  --text: #2c1c14;
  --muted: #725645;
  --accent: #9f2f24;
  --accent-soft: #d98f67;
  --gold: #b2832f;
  --rank-xgreat: #8d5a12;
  --rank-xgreat-soft: #ffe08a;
  --rank-great: #b7821f;
  --rank-great-soft: #fff1bf;
  --rank-good: #2f7a4e;
  --rank-good-soft: #dff5e7;
  --rank-mid: #c66a18;
  --rank-mid-soft: #ffe7c6;
  --rank-small: #8c6f31;
  --rank-small-soft: #efe4c3;
  --rank-care: #b33a2f;
  --rank-care-soft: #ffd9d2;
  --shadow: 0 24px 60px rgba(67, 37, 16, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-size: 15px;
  font-family: "Zen Kaku Gothic New", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.6), transparent 30%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  z-index: -1;
  border-radius: 999px;
  filter: blur(10px);
}

body::before {
  width: 22rem;
  height: 22rem;
  top: -6rem;
  right: -4rem;
  background: rgba(159, 47, 36, 0.12);
}

body::after {
  width: 20rem;
  height: 20rem;
  left: -5rem;
  bottom: -6rem;
  background: rgba(178, 131, 47, 0.14);
}

.page-shell {
  width: min(1760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 3rem 0 4rem;
}

.hero {
  text-align: center;
  margin-bottom: 2rem;
}

.eyebrow {
  margin: 0 0 0.5rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
}

h1,
h2,
h3,
.metric strong {
  font-family: "Zen Old Mincho", serif;
}

h1 {
  margin: 0;
  font-size: clamp(2.5rem, 7vw, 4.6rem);
  font-weight: 700;
}

.hero-copy,
.section-copy,
.lead,
.messages p,
.field span,
.metric small {
  color: var(--muted);
}

.hero-copy {
  width: min(42rem, 100%);
  margin: 1rem auto 0;
  line-height: 1.8;
}

.layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
}

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.form-card,
.result-card {
  padding: 1.5rem;
}

.result-area {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.62fr);
  gap: 1.25rem;
  align-items: start;
  scroll-margin-top: 7rem;
}

.result-card {
  grid-column: 1;
  grid-row: 1 / span 4;
}

.fortune-form {
  display: grid;
  gap: 1rem;
  margin-top: 1.25rem;
}

.name-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.field {
  display: grid;
  gap: 0.45rem;
}

.field span {
  font-size: 0.95rem;
  font-weight: 700;
}

.mode-toggle {
  display: grid;
  gap: 0.25rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  border: 1px solid rgba(72, 45, 28, 0.1);
  background: rgba(255, 255, 255, 0.68);
}

.mode-toggle input {
  width: auto;
  margin: 0;
}

.mode-toggle span {
  color: var(--text);
  font-weight: 700;
}

.mode-toggle small {
  color: var(--muted);
  line-height: 1.6;
}

input {
  width: 100%;
  border: 1px solid rgba(72, 45, 28, 0.14);
  border-radius: 16px;
  padding: 0.95rem 1rem;
  font-size: 1.05rem;
  font-family: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.85);
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

input:focus {
  outline: none;
  border-color: var(--accent-soft);
  transform: translateY(-1px);
  box-shadow: 0 0 0 4px rgba(217, 143, 103, 0.18);
}

.actions {
  display: flex;
  gap: 0.75rem;
  padding-top: 0.4rem;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.95rem 1.2rem;
  font-size: 0.96rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 180ms ease, opacity 180ms ease, box-shadow 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button[type="submit"] {
  flex: 1;
  color: #fffaf6;
  background: linear-gradient(135deg, var(--accent), #c45c2d);
  box-shadow: 0 14px 24px rgba(159, 47, 36, 0.22);
}

button.ghost {
  color: var(--accent);
  background: rgba(255, 250, 246, 0.7);
  border: 1px solid rgba(159, 47, 36, 0.12);
}

.wide-button {
  width: 100%;
}

.mobile-only {
  display: none;
}

.mobile-tabs {
  display: none;
}

.mobile-tab {
  width: 100%;
}

.desktop-side-tabs {
  display: inline-flex;
  grid-column: 2;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem;
  border-radius: 999px;
  background: rgba(255, 250, 246, 0.72);
  border: 1px solid rgba(159, 47, 36, 0.12);
  box-shadow: 0 12px 24px rgba(44, 28, 20, 0.08);
  justify-self: stretch;
}

.desktop-side-tab {
  width: auto;
  padding: 0.6rem 0.9rem;
  border-radius: 999px;
  border: none;
  background: transparent;
  color: var(--accent);
  box-shadow: none;
  font-size: 0.9rem;
}

.desktop-side-tab.is-active {
  color: #fffaf6;
  background: linear-gradient(135deg, var(--accent), #c45c2d);
  box-shadow: 0 10px 20px rgba(159, 47, 36, 0.18);
}

.result-title-wrap {
  display: flex;
  align-items: center;
  min-width: 0;
}

.result-heading {
  min-width: 0;
}

.result-name-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.copy-name-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.copy-name-icon {
  display: block;
  width: 0.96rem;
  height: 0.96rem;
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.copy-name-button::after {
  content: attr(data-feedback);
  position: absolute;
  top: calc(100% + 0.15rem);
  left: 50%;
  transform: translate(-50%, -0.2rem);
  padding: 0.26rem 0.42rem;
  border-radius: 999px;
  background: rgba(72, 45, 28, 0.92);
  color: #fffaf6;
  font-size: 0.72rem;
  line-height: 1;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.copy-name-button.is-feedback-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.favorite-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border-radius: 0;
  border: none;
  background: transparent;
  box-shadow: none;
}

.favorite-icon {
  display: block;
  flex: 0 0 auto;
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  min-height: 1rem;
  overflow: visible;
  fill: none;
  stroke-width: 1.8;
}

.favorite-off {
  stroke: var(--gold);
}

.favorite-on {
  display: none;
  fill: #f4c850;
  stroke: #b2832f;
}

.favorite-toggle.is-active .favorite-off {
  display: none;
}

.favorite-toggle.is-active .favorite-on {
  display: block;
}

.accordion-toggle {
  display: none;
}

.accordion-card .accordion-body[hidden] {
  display: block;
}

.accordion-arrow {
  display: none;
}

.metric-note-inline {
  display: none;
  margin-top: 0.45rem;
  color: var(--muted);
  line-height: 1.7;
}

.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.result-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  flex: 0 0 auto;
}

.result-head h2 {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.fortune-overview {
  margin-top: 1rem;
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: rgba(255, 250, 246, 0.85);
  border: 1px solid rgba(72, 45, 28, 0.08);
}

.fortune-overview strong {
  display: block;
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.fortune-overview p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.fortune-overview[data-rank="xgreat"],
.fortune-overview[data-rank="great"],
.fortune-overview[data-rank="good"],
.fortune-overview[data-rank="mid"],
.fortune-overview[data-rank="small"],
.fortune-overview[data-rank="care"] {
  border-width: 2px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.45);
}

.fortune-overview[data-rank="xgreat"] {
  background: linear-gradient(135deg, rgba(255, 220, 122, 0.98), rgba(255, 242, 194, 0.98));
  border-color: rgba(141, 90, 18, 0.56);
}

.fortune-overview[data-rank="great"] {
  background: linear-gradient(135deg, rgba(255, 235, 167, 0.95), rgba(255, 248, 224, 0.96));
  border-color: rgba(183, 130, 31, 0.55);
}

.fortune-overview[data-rank="good"] {
  background: linear-gradient(135deg, rgba(218, 245, 227, 0.96), rgba(241, 255, 246, 0.96));
  border-color: rgba(47, 122, 78, 0.38);
}

.fortune-overview[data-rank="mid"] {
  background: linear-gradient(135deg, rgba(255, 229, 188, 0.96), rgba(255, 245, 232, 0.96));
  border-color: rgba(198, 106, 24, 0.36);
}

.fortune-overview[data-rank="small"] {
  background: linear-gradient(135deg, rgba(239, 228, 195, 0.96), rgba(248, 242, 225, 0.96));
  border-color: rgba(140, 111, 49, 0.34);
}

.fortune-overview[data-rank="care"] {
  background: linear-gradient(135deg, rgba(255, 218, 210, 0.96), rgba(255, 241, 238, 0.96));
  border-color: rgba(179, 58, 47, 0.38);
}

.fortune-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 7rem;
  padding: 0.75rem 1rem;
  border-radius: 999px;
  border: 2px solid transparent;
  font-weight: 700;
  box-shadow: 0 12px 24px rgba(44, 28, 20, 0.12);
}

.fortune-badge[data-rank="great"] {
  color: #7c570d;
  background: linear-gradient(135deg, var(--rank-great-soft), #fff7dc);
  border-color: rgba(183, 130, 31, 0.45);
}

.fortune-badge[data-rank="xgreat"] {
  color: #643d06;
  background: linear-gradient(135deg, var(--rank-xgreat-soft), #fff0ba);
  border-color: rgba(141, 90, 18, 0.46);
}

.fortune-badge[data-rank="good"] {
  color: #20593a;
  background: linear-gradient(135deg, var(--rank-good-soft), #f3fff7);
  border-color: rgba(47, 122, 78, 0.35);
}

.fortune-badge[data-rank="mid"] {
  color: #8e4b10;
  background: linear-gradient(135deg, var(--rank-mid-soft), #fff6e7);
  border-color: rgba(198, 106, 24, 0.35);
}

.fortune-badge[data-rank="small"] {
  color: #6f5727;
  background: linear-gradient(135deg, var(--rank-small-soft), #f8f2e2);
  border-color: rgba(140, 111, 49, 0.34);
}

.fortune-badge[data-rank="care"] {
  color: #8b241c;
  background: linear-gradient(135deg, var(--rank-care-soft), #fff3f0);
  border-color: rgba(179, 58, 47, 0.35);
}

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.9rem;
  margin-top: 1.5rem;
}

.metric {
  padding: 1rem;
  border-radius: 20px;
  background: var(--paper-strong);
  border: 2px solid rgba(72, 45, 28, 0.08);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.42);
}

.metric span {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
}

.metric strong {
  display: block;
  font-size: 2rem;
  margin-bottom: 0.2rem;
}

.metric-formula {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text);
  font-weight: 700;
  line-height: 1.55;
}

.metric-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.7rem;
  padding: 0.28rem 0.62rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(114, 86, 69, 0.1);
  color: var(--muted);
}

.metric[data-rank="great"],
.metric[data-rank="good"] {
  position: relative;
}

.metric[data-rank="xgreat"] {
  border-color: rgba(141, 90, 18, 0.54);
  background: linear-gradient(180deg, #fff0bb 0%, #ffdf89 100%);
}

.metric[data-rank="great"] {
  border-color: rgba(183, 130, 31, 0.5);
  background: linear-gradient(180deg, #fff7de 0%, #ffefbf 100%);
}

.metric[data-rank="good"] {
  border-color: rgba(47, 122, 78, 0.36);
  background: linear-gradient(180deg, #f0fff5 0%, #dff5e7 100%);
}

.metric[data-rank="mid"] {
  border-color: rgba(198, 106, 24, 0.34);
  background: linear-gradient(180deg, #fff5e8 0%, #ffe7c6 100%);
}

.metric[data-rank="small"] {
  border-color: rgba(140, 111, 49, 0.32);
  background: linear-gradient(180deg, #f8f3e6 0%, #efe4c3 100%);
}

.metric[data-rank="care"] {
  border-color: rgba(179, 58, 47, 0.36);
  background: linear-gradient(180deg, #fff4f1 0%, #ffd9d2 100%);
}

.metric[data-rank="xgreat"] .metric-status {
  background: rgba(141, 90, 18, 0.2);
  color: #643d06;
}

.metric[data-rank="great"] .metric-status {
  background: rgba(183, 130, 31, 0.2);
  color: #7c570d;
}

.metric[data-rank="good"] .metric-status {
  background: rgba(47, 122, 78, 0.18);
  color: #20593a;
}

.metric[data-rank="mid"] .metric-status {
  background: rgba(198, 106, 24, 0.18);
  color: #8e4b10;
}

.metric[data-rank="small"] .metric-status {
  background: rgba(140, 111, 49, 0.18);
  color: #6f5727;
}

.metric[data-rank="care"] .metric-status {
  background: rgba(179, 58, 47, 0.18);
  color: #8b241c;
}

.metric.emphasis {
  grid-column: span 2;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 10px 24px rgba(67, 37, 16, 0.08);
}

.messages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.5rem;
}

.messages > div {
  padding: 1rem 1.1rem;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px solid rgba(72, 45, 28, 0.08);
}

.messages h3 {
  margin: 0 0 0.4rem;
  font-size: 1.08rem;
}

.messages p {
  margin: 0;
  line-height: 1.8;
}

.number-comments {
  margin-top: 1.5rem;
  padding: 1.15rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(72, 45, 28, 0.08);
}

.number-comments-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.number-comment-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 1rem;
}

.number-comment {
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(255, 250, 246, 0.88);
  border: 1px solid rgba(72, 45, 28, 0.08);
}

.number-comment h4 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.number-comment p {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
  font-size: 0.94rem;
}

.suggestions-panel {
  padding: 1.15rem;
  border-radius: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 1rem;
  grid-column: 2;
}

.history-panel {
  padding: 1.15rem;
  border-radius: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 1rem;
  grid-column: 2;
}

.favorites-panel {
  padding: 1.15rem;
  border-radius: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  position: sticky;
  top: 1rem;
  grid-column: 2;
}

.side-panel {
  display: none;
}

.side-panel.is-active {
  display: block;
}

.favorites-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.favorites-head p:last-child {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.suggestions {
  padding: 1.15rem;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.52);
  border: 1px solid rgba(72, 45, 28, 0.08);
}

.suggestions-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.suggestions-head p:last-child {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.history-head h3 {
  margin: 0;
  font-size: 1.15rem;
}

.history-head p:last-child {
  margin: 0.45rem 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.suggestion-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.suggestion-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 1rem;
  border-radius: 18px;
  background: rgba(255, 250, 246, 0.88);
  border: 1px solid rgba(72, 45, 28, 0.08);
}

.suggestion-meta {
  display: grid;
  gap: 0.25rem;
  min-width: 0;
  flex: 1 1 auto;
}

.list-info {
  display: grid;
  gap: 0.22rem;
  min-width: 0;
  flex: 1 1 auto;
}

.list-name-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
}

.list-name-row strong {
  min-width: 0;
  margin: 0;
  font-size: 1rem;
  flex: 0 1 auto;
}

.list-name-row .copy-name-button {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  flex: 0 0 2rem;
}

.list-name-row .copy-name-icon {
  display: block;
  width: 1rem;
  height: 1rem;
  min-width: 1rem;
  min-height: 1rem;
  flex: 0 0 auto;
}

.favorite-card .favorite-toggle,
.suggestion-card .favorite-toggle,
.history-card .favorite-toggle {
  align-self: center;
  width: 1.4rem;
  height: 1.4rem;
}

.favorite-card .favorite-icon,
.suggestion-card .favorite-icon,
.history-card .favorite-icon {
  width: 0.78rem;
  height: 0.78rem;
}

.suggestion-card strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1.02rem;
}

.suggestion-card button {
  white-space: nowrap;
  padding-inline: 1rem;
}

.suggestion-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.history-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.favorites-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 1rem;
}

.history-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
  padding: 0.95rem 1rem;
  border-radius: 18px;
  background: rgba(255, 250, 246, 0.88);
  border: 1px solid rgba(72, 45, 28, 0.08);
}

.history-card strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 1rem;
}

.list-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.7rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.history-card button {
  width: auto;
}

.history-empty {
  margin: 0;
  color: var(--muted);
  line-height: 1.75;
}

.site-footer {
  margin-top: 2rem;
  padding: 1.2rem 1.4rem;
  border-radius: 24px;
  background: rgba(255, 251, 245, 0.76);
  border: 1px solid rgba(72, 45, 28, 0.08);
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.2rem;
}

.footer-links a,
.policy-card a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 700;
}

.footer-note {
  margin: 0.9rem 0 0;
  color: var(--muted);
  line-height: 1.75;
}

.policy-shell {
  width: min(920px, calc(100% - 2rem));
}

.policy-card {
  padding: 1.6rem;
  border-radius: 28px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.policy-card h1 {
  margin-bottom: 1rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.policy-card p {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.9;
}

@media (max-width: 860px) {
  body {
    font-size: 14px;
  }

  .hero {
    margin-bottom: 0.9rem;
  }

  .hero .eyebrow,
  .hero-copy,
  .form-card h2,
  .form-card .section-copy {
    display: none;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 0.9rem;
  }

  .result-area {
    grid-template-columns: 1fr;
  }

  .result-card,
  .favorites-panel,
  .suggestions-panel,
  .history-panel {
    grid-column: auto;
    grid-row: auto;
  }

  .desktop-side-tabs {
    display: none;
  }

  .mobile-tabs {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .mobile-tab {
    color: var(--accent);
    background: rgba(255, 250, 246, 0.78);
    border: 1px solid rgba(159, 47, 36, 0.12);
    box-shadow: none;
  }

  .mobile-tab.is-active {
    color: #fffaf6;
    background: linear-gradient(135deg, var(--accent), #c45c2d);
    box-shadow: 0 12px 22px rgba(159, 47, 36, 0.18);
  }

  .mobile-panel {
    display: none;
  }

  .mobile-panel.is-active {
    display: block;
  }

  .accordion-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: none;
    border-radius: 14px;
    background: transparent;
    color: var(--text);
    box-shadow: none;
    text-align: left;
  }

  .accordion-label {
    display: inline-flex;
    align-items: baseline;
    gap: 0.28rem;
    min-width: 0;
    font-size: 0.83rem;
    font-weight: 700;
    white-space: nowrap;
  }

  .accordion-sub {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--muted);
    white-space: nowrap;
  }

  .accordion-summary {
    flex: 0 0 auto;
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--muted);
    white-space: nowrap;
  }

  .accordion-arrow {
    display: block;
    flex: 0 0 auto;
    width: 0.95rem;
    height: 0.95rem;
    stroke: currentColor;
    stroke-width: 1.9;
    fill: none;
    color: var(--muted);
    transition: transform 180ms ease;
  }

  .accordion-card.is-open .accordion-arrow {
    transform: rotate(180deg);
  }

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

  .result-head,
  .actions,
  .messages,
  .number-comment-list,
  .suggestion-card {
    grid-template-columns: 1fr;
  }

  .result-head {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
  }

  .result-title-wrap {
    align-items: center;
  }

  .result-name-row {
    gap: 0.42rem;
  }

  .result-head .eyebrow {
    display: none;
  }

  .result-head h2 {
    font-size: 1.16rem;
    line-height: 1.2;
  }

  .fortune-badge {
    min-width: auto;
    padding: 0.38rem 0.62rem;
    font-size: 0.74rem;
    box-shadow: none;
  }

  .result-tools {
    gap: 0.4rem;
  }

  .copy-name-button {
    width: 1.62rem;
    height: 1.62rem;
  }

  .copy-name-icon {
    width: 0.82rem;
    height: 0.82rem;
  }

  .suggestion-card {
    display: grid;
  }

  .form-card {
    position: sticky;
    top: 0.5rem;
    z-index: 30;
    padding: 1rem;
    border-radius: 22px;
    background: rgba(255, 251, 245, 0.96);
    backdrop-filter: blur(20px);
  }

  .fortune-form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 0;
    gap: 0.45rem;
  }

  .name-row {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
  }

  .field {
    display: flex;
    align-items: center;
    gap: 0.45rem;
  }

  .field span {
    flex: 0 0 auto;
    min-width: 1.2rem;
    font-size: 0.76rem;
    line-height: 1;
  }

  input {
    padding: 0.68rem 0.78rem;
    font-size: 0.94rem;
    border-radius: 14px;
  }

  .mode-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    width: auto;
    padding: 0.58rem 0.78rem;
    border-radius: 999px;
  }

  .mode-toggle small {
    display: none;
  }

  .mode-toggle span {
    font-size: 0.84rem;
  }

  .actions {
    display: flex;
    width: auto;
    gap: 0;
    padding-top: 0;
  }

  button {
    width: auto;
    padding: 0.58rem 0.78rem;
    font-size: 0.8rem;
  }

  .mobile-tab {
    padding: 0.46rem 0.45rem;
    font-size: 0.76rem;
  }

  .wide-button {
    width: auto;
  }

  .desktop-only {
    display: none;
  }

  .mobile-only {
    display: inline;
  }

  .favorites-panel,
  .suggestions-panel,
  .history-panel {
    position: static;
  }

  .favorites-head .eyebrow,
  .suggestions-head .eyebrow,
  .history-head .eyebrow,
  .favorites-head h3,
  .suggestions-head h3,
  .history-head h3 {
    display: none;
  }

  .favorite-toggle {
    width: 1.72rem;
    height: 1.72rem;
    margin-top: 0;
  }

  .favorite-icon {
    width: 0.92rem;
    height: 0.92rem;
  }

  .favorites-list,
  .suggestion-list,
  .history-list {
    gap: 0.55rem;
    margin-top: 0.7rem;
  }

  .favorite-card,
  .suggestion-card,
  .history-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.45rem;
    padding: 0.62rem 0.72rem;
  }

  .favorite-card .favorite-toggle,
  .suggestion-card .favorite-toggle,
  .history-card .favorite-toggle {
    width: 2.3rem;
    height: 2.3rem;
  }

  .favorite-card .favorite-icon,
  .suggestion-card .favorite-icon,
  .history-card .favorite-icon {
    width: 1.24rem;
    height: 1.24rem;
  }

  .suggestion-meta,
  .list-info,
  .list-meta {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    min-width: 0;
    flex: 1 1 auto;
  }

  .suggestion-card strong,
  .history-card strong,
  .favorite-card strong,
  .list-meta span {
    margin: 0;
    font-size: 0.76rem;
    line-height: 1.2;
    white-space: nowrap;
  }

  .favorite-card button,
  .suggestion-card button,
  .history-card button {
    flex: 0 0 auto;
    width: auto;
    padding: 0.38rem 0.62rem;
    font-size: 0.74rem;
    white-space: nowrap;
  }

  .overview-accordion {
    margin-top: 0.85rem;
    padding: 0.12rem;
    border-radius: 18px;
    border: 1px solid rgba(72, 45, 28, 0.08);
    background: rgba(255, 250, 246, 0.88);
  }

  .overview-accordion[data-rank="xgreat"] {
    background: linear-gradient(135deg, rgba(255, 220, 122, 0.98), rgba(255, 242, 194, 0.98));
    border-color: rgba(141, 90, 18, 0.56);
  }

  .overview-accordion[data-rank="great"] {
    background: linear-gradient(135deg, rgba(255, 235, 167, 0.95), rgba(255, 248, 224, 0.96));
    border-color: rgba(183, 130, 31, 0.55);
  }

  .overview-accordion[data-rank="good"] {
    background: linear-gradient(135deg, rgba(218, 245, 227, 0.96), rgba(241, 255, 246, 0.96));
    border-color: rgba(47, 122, 78, 0.38);
  }

  .overview-accordion[data-rank="mid"] {
    background: linear-gradient(135deg, rgba(255, 229, 188, 0.96), rgba(255, 245, 232, 0.96));
    border-color: rgba(198, 106, 24, 0.36);
  }

  .overview-accordion[data-rank="small"] {
    background: linear-gradient(135deg, rgba(239, 228, 195, 0.96), rgba(248, 242, 225, 0.96));
    border-color: rgba(140, 111, 49, 0.34);
  }

  .overview-accordion[data-rank="care"] {
    background: linear-gradient(135deg, rgba(255, 218, 210, 0.96), rgba(255, 241, 238, 0.96));
    border-color: rgba(179, 58, 47, 0.38);
  }

  .overview-toggle {
    background: transparent;
  }

  .overview-accordion .accordion-body {
    margin-top: 0.5rem;
    padding: 0 0.45rem 0.45rem;
  }

  .overview-accordion .fortune-overview {
    margin-top: 0;
    padding: 0;
    border: none;
    background: transparent;
    box-shadow: none;
  }

  .overview-accordion .fortune-overview strong {
    margin-bottom: 0.2rem;
  }

  .warning-accordion {
    margin-top: 0.6rem;
  }

  .warning-accordion .messages {
    margin-top: 0;
  }

  .warning-accordion .messages > div {
    padding: 0.8rem 0.9rem;
  }

  .footer-links {
    display: grid;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 0.6rem;
  }

  .metric {
    padding: 0.45rem;
  }

  .metric.emphasis {
    grid-column: span 1;
  }

  .metric > span,
  .number-comments {
    display: none;
  }

  .metric-body {
    padding: 0.12rem 0.35rem 0.3rem;
  }

  .metric strong {
    font-size: 1.5rem;
    margin-bottom: 0.15rem;
  }

  .metric-status {
    margin-bottom: 0.45rem;
  }

  .metric-note-inline {
    display: block;
  }

  .messages {
    display: grid;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 1.2rem;
  }

  .result-card,
  .suggestions-panel,
  .history-panel {
    padding: 1.1rem;
    border-radius: 22px;
  }

  .actions,
  .grid,
  .messages,
  .number-comment-list {
    display: grid;
  }

}
