:root {
  color-scheme: light dark;
  --bg: #f6f8fc;
  --card: #ffffff;
  --text: #121722;
  --muted: #5b6578;
  --accent: #1f6feb;
  --border: #d5deed;
  --surface: #f8fbff;
}

body.dark {
  --bg: #0f141d;
  --card: #171e29;
  --text: #e8eefc;
  --muted: #a0afc6;
  --accent: #6aa8ff;
  --border: #2c3b50;
  --surface: #111824;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top right, #e2eeff 0%, var(--bg) 48%);
  color: var(--text);
  min-height: 100vh;
  padding: 0 1rem 1rem;
}

body.dark {
  background: var(--bg);
}

.container {
  width: min(760px, 100%);
  margin: max(1rem, calc(50vh - 185px)) auto 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  box-shadow: 0 10px 40px rgba(18, 23, 34, 0.08);
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2.5vw, 1.8rem);
}

.titleRow {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
}

.subtitle {
  margin: 0.35rem 0 1rem;
  color: var(--muted);
}

label {
  font-size: 0.92rem;
  font-weight: 600;
}

.row {
  margin-top: 0.5rem;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.65rem;
}

input,
button {
  font: inherit;
}

input {
  width: 100%;
  padding: 0.72rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}

input:focus {
  border-color: var(--accent);
  outline: 2px solid color-mix(in srgb, var(--accent), white 75%);
}

button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 0.72rem 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.94);
}

.themeToggle {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  padding: 0.5rem 0.72rem;
  font-size: 0.88rem;
}

.hint,
.muted {
  color: var(--muted);
}

.hint {
  font-size: 0.9rem;
  margin: 0.7rem 0 0;
}

.result {
  margin-top: 1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem;
  background: var(--surface);
}

.result p {
  margin: 0.15rem 0;
}

@media (prefers-color-scheme: dark) {
  body:not(.light) {
    --bg: #0f141d;
    --card: #171e29;
    --text: #e8eefc;
    --muted: #a0afc6;
    --accent: #6aa8ff;
    --border: #2c3b50;
    --surface: #111824;
  }
}

@media (max-width: 560px) {
  .row {
    grid-template-columns: 1fr;
  }

  button {
    width: 100%;
  }

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

  .themeToggle {
    width: auto;
  }
}
