:root {
  color-scheme: dark;
  --bg: #0b0b12;
  --surface: rgba(25, 24, 38, 0.88);
  --surface-strong: #211f31;
  --text: #f7f5ff;
  --muted: #aaa6bb;
  --line: rgba(255, 255, 255, 0.1);
  --purple: #9a7bff;
  --pink: #ff70c3;
  --cyan: #61d8ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, "Noto Sans JP", "Yu Gothic UI", system-ui, sans-serif;
  background:
    radial-gradient(circle at 14% 8%, rgba(154, 123, 255, 0.2), transparent 28rem),
    radial-gradient(circle at 92% 72%, rgba(255, 112, 195, 0.13), transparent 26rem),
    linear-gradient(160deg, #0b0b12 0%, #11101b 54%, #0b0b12 100%);
}

body::before {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
  opacity: 0.2;
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(to bottom, black, transparent 90%);
}

button,
textarea,
input {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  position: relative;
  width: min(760px, calc(100% - 32px));
  margin: 0 auto;
  padding: 68px 0 32px;
}

.hero {
  margin-bottom: 30px;
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  padding: 7px 12px;
  color: #d5c9ff;
  border: 1px solid rgba(154, 123, 255, 0.34);
  border-radius: 999px;
  background: rgba(154, 123, 255, 0.1);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2.25rem, 8vw, 4.4rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

.hero h1 span {
  color: transparent;
  background: linear-gradient(100deg, var(--purple), var(--pink));
  background-clip: text;
  -webkit-background-clip: text;
}

.hero p {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: clamp(0.95rem, 3vw, 1.08rem);
}

.card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(32, 30, 47, 0.92), rgba(18, 18, 29, 0.92));
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.controls {
  padding: clamp(22px, 5vw, 36px);
}

.field-label {
  display: block;
  margin-bottom: 10px;
  font-size: 0.92rem;
  font-weight: 750;
}

textarea {
  width: 100%;
  min-height: 126px;
  resize: vertical;
  padding: 16px 17px;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  outline: none;
  background: rgba(8, 8, 15, 0.64);
  line-height: 1.7;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea::placeholder {
  color: #777386;
}

textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 4px rgba(154, 123, 255, 0.13);
}

.slop-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 28px;
}

.slop-heading .field-label {
  margin: 0;
}

.slop-value {
  min-width: 3.3rem;
  padding: 5px 10px;
  color: #160f24;
  border-radius: 9px;
  background: linear-gradient(120deg, #cabaff, #ff9bd6);
  font-weight: 900;
  text-align: center;
}

input[type="range"] {
  width: 100%;
  height: 8px;
  margin: 18px 0 8px;
  border-radius: 999px;
  outline: none;
  appearance: none;
  background: linear-gradient(90deg, var(--cyan) 0%, var(--purple) 50%, var(--pink) 100%);
}

input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  border: 4px solid #fff;
  border-radius: 50%;
  appearance: none;
  background: var(--purple);
  box-shadow: 0 3px 15px rgba(154, 123, 255, 0.55);
  cursor: grab;
}

input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: 4px solid #fff;
  border-radius: 50%;
  background: var(--purple);
  box-shadow: 0 3px 15px rgba(154, 123, 255, 0.55);
  cursor: grab;
}

.range-labels {
  display: flex;
  justify-content: space-between;
  color: #8e899e;
  font-size: 0.75rem;
  line-height: 1.25;
}

.range-labels span:nth-child(2) {
  text-align: center;
}

.range-labels span:last-child {
  text-align: right;
}

.range-labels small {
  font-size: 0.68rem;
}

.level-guide {
  min-height: 1.5em;
  margin: 16px 0 20px;
  color: #c3bed1;
  font-size: 0.86rem;
  line-height: 1.55;
}

.primary-button,
.secondary-button {
  border: 0;
  cursor: pointer;
  transition: transform 150ms ease, filter 150ms ease, border-color 150ms ease;
}

.primary-button {
  width: 100%;
  padding: 15px 20px;
  color: #130c20;
  border-radius: 13px;
  background: linear-gradient(105deg, #b49aff, #ff84ca);
  box-shadow: 0 12px 30px rgba(190, 112, 255, 0.25);
  font-weight: 900;
}

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

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

.result-card {
  display: none;
  margin-top: 20px;
  padding: clamp(22px, 5vw, 34px);
}

.result-card.visible {
  display: block;
  animation: reveal 300ms ease both;
}

.result-header {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.result-kicker {
  margin: 0 0 4px;
  color: var(--pink);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.result-header h2 {
  margin: 0;
  font-size: 1.15rem;
}

.result-level {
  flex: 0 0 auto;
  padding: 7px 10px;
  color: #cfc7df;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 0.72rem;
}

.result {
  padding: 21px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(7, 7, 13, 0.55);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.9;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 16px;
}

.secondary-button {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.055);
  font-size: 0.88rem;
  font-weight: 750;
}

.secondary-button.accent {
  color: #e5dcff;
  border-color: rgba(154, 123, 255, 0.42);
  background: rgba(154, 123, 255, 0.11);
}

footer {
  padding: 24px 8px 0;
  color: #706c7d;
  font-size: 0.72rem;
  text-align: center;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 560px) {
  .app-shell {
    width: min(100% - 20px, 760px);
    padding-top: 38px;
  }

  .card {
    border-radius: 18px;
  }

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

  .result-header {
    align-items: center;
  }
}

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