:root {
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f0f5f8;
  --text: #15202b;
  --muted: #4d6376;
  --line: #d5dde5;
  --brand: #0f7a8d;
  --brand-strong: #0a6172;
  --accent: #f4a11a;
  --danger: #b63b35;
  --warning: #a86700;
  --success: #0a7f45;
  --radius-lg: 20px;
  --radius-md: 12px;
  --shadow: 0 22px 50px -28px rgba(13, 36, 58, 0.45);
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: "Noto Sans JP", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 10% 12%, #d9f3f8 0%, transparent 36%),
    radial-gradient(circle at 90% 85%, #ffe7bf 0%, transparent 33%),
    linear-gradient(135deg, #f3f8fa 0%, #f6f8fb 45%, #fff9ee 100%);
  line-height: 1.5;
  padding: 24px 16px 40px;
}

.background-orb {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(28px);
  z-index: 0;
}

.orb-a {
  width: 190px;
  height: 190px;
  top: 30px;
  right: 7%;
  background: rgba(15, 122, 141, 0.18);
}

.orb-b {
  width: 230px;
  height: 230px;
  bottom: 40px;
  left: 5%;
  background: rgba(244, 161, 26, 0.16);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 16px;
}

.hero {
  background: linear-gradient(120deg, #0e7080 0%, #126273 52%, #2f516b 100%);
  color: #f8fdff;
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.lang-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 42px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(213, 236, 248, 0.55);
  color: rgba(243, 252, 255, 0.88);
  font-family: "Sora", "Noto Sans JP", sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-decoration: none;
  background: rgba(19, 75, 93, 0.28);
}

.lang-link:hover {
  background: rgba(20, 106, 129, 0.42);
  color: #ffffff;
}

.lang-link.is-active {
  border-color: rgba(255, 255, 255, 0.8);
  background: rgba(251, 255, 255, 0.92);
  color: #0f5a73;
}

.hero-kicker {
  margin: 0 0 8px;
  font-family: "Sora", "Noto Sans JP", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.82;
}

.hero h1 {
  margin: 0 0 8px;
  font-family: "Sora", "Noto Sans JP", sans-serif;
  font-size: clamp(1.45rem, 2.7vw, 2rem);
  line-height: 1.2;
}

.hero-text {
  margin: 0;
  color: rgba(248, 253, 255, 0.9);
  max-width: 66ch;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: 0 14px 35px -28px rgba(12, 30, 48, 0.6);
}

.controls-panel {
  padding: 14px 14px 12px;
}

.workspace-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  grid-template-areas:
    "controls"
    "output";
}

.controls-panel {
  grid-area: controls;
}

.output-panel {
  grid-area: output;
  display: flex;
  flex-direction: column;
}

.length-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid #d7e2eb;
  border-radius: 10px;
  background: #f7fbfe;
}

.length-row label {
  font-family: "Sora", "Noto Sans JP", sans-serif;
  font-weight: 600;
  color: #2a4b61;
  white-space: nowrap;
}

#lengthInput {
  width: 100%;
  min-width: 0;
  max-width: 240px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font: inherit;
  font-weight: 600;
  color: #1b3f54;
  background: var(--surface-soft);
}

#lengthInput:focus,
button:focus,
input[type="checkbox"]:focus {
  outline: 3px solid rgba(15, 122, 141, 0.28);
  outline-offset: 1px;
}

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

.option-group {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px 8px 4px;
  background: #fafcfe;
}

.option-group legend {
  font-family: "Sora", "Noto Sans JP", sans-serif;
  font-size: 0.86rem;
  font-weight: 600;
  color: #1a4c64;
  padding: 0 6px;
}

.option-group label {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 4px;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}

.option-group input[type="checkbox"] {
  width: 16px;
  height: 16px;
}

.action-row {
  margin-top: 6px;
  margin-bottom: 8px;
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: center;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 11px 18px;
  font-family: "Sora", "Noto Sans JP", sans-serif;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(100deg, var(--brand) 0%, var(--brand-strong) 100%);
  color: #f4fcff;
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  background: #edf4f8;
  color: #16435a;
  border: 1px solid #cedbe3;
}

.btn-secondary:hover {
  background: #e5eef4;
}

.shortcut-hint {
  color: var(--muted);
  font-size: 0.9rem;
}

.shortcut-panel {
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid #d7e2eb;
  border-radius: 10px;
  background: #f7fbfe;
}

.shortcut-title {
  margin: 0 0 6px;
  font-family: "Sora", "Noto Sans JP", sans-serif;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #3e6076;
}

.shortcut-chips {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 7px;
  justify-content: flex-start;
}

.shortcut-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 0;
  background: transparent;
  border-radius: 0;
  padding: 0;
  font-size: 0.92rem;
  color: #345469;
}

kbd {
  font-family: "Sora", "Noto Sans JP", sans-serif;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 2px 6px;
  border: 1px solid #b8c8d4;
  border-bottom-width: 2px;
  border-radius: 6px;
  background: #ffffff;
  color: #1c3f54;
}

.output-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.output-panel label {
  display: block;
  font-family: "Sora", "Noto Sans JP", sans-serif;
  font-weight: 600;
}

.output-length {
  display: inline-block;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.84rem;
  font-weight: 600;
  color: #155071;
  background: #e9f4fb;
  border: 1px solid #c4dceb;
}

#outputText {
  width: 100%;
  flex: 1;
  min-height: 168px;
  resize: vertical;
  border: 1px solid #9ebcd0;
  border-radius: var(--radius-md);
  padding: 14px;
  font-family: "Sora", "Noto Sans JP", "Courier New", monospace;
  font-size: 1.06rem;
  font-weight: 500;
  letter-spacing: 0.015em;
  line-height: 1.6;
  word-break: break-all;
  background: linear-gradient(180deg, #fdfefe 0%, #f6fbff 100%);
  color: #08283b;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

#outputText:focus {
  outline: 3px solid rgba(15, 122, 141, 0.25);
  border-color: #2b87aa;
}

.status {
  margin: 10px 0 0;
  min-height: 1.5em;
  color: var(--muted);
}

.status.error {
  color: var(--danger);
}

.status.warning {
  color: var(--warning);
}

.status.success {
  color: var(--success);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(88vw, 360px);
  background: #143b53;
  color: #f2f9ff;
  border: 1px solid rgba(203, 231, 250, 0.3);
  border-radius: 12px;
  padding: 11px 14px;
  box-shadow: 0 16px 35px -18px rgba(10, 29, 44, 0.65);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 30;
  font-size: 0.92rem;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 620px) {
  .output-head {
    flex-direction: column;
    align-items: flex-start;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    max-width: none;
  }
}

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

  .action-row {
    flex-wrap: wrap;
  }

  .length-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  #lengthInput {
    width: 100%;
    max-width: none;
  }
}

@media (min-width: 1040px) {
  .workspace-grid {
    grid-template-columns: minmax(360px, 1fr) minmax(440px, 1.25fr);
    grid-template-areas: "controls output";
    align-items: stretch;
  }
}
