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

:root {
  --bg: #0d1117;
  --surface: #161b22;
  --surface-hover: #1c2333;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-dim: #1f6feb;
  --green: #3fb950;
  --flag-bg: #1f2937;
  --flag-text: #7ee787;
}

html {
  font-size: 15px;
}

body {
  font-family: "Fira Code", "SF Mono", "Cascadia Code", "JetBrains Mono", Consolas, monospace;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
  border-bottom: 1px solid var(--border);
}

header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--green);
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 0.25rem;
}

.subtitle_2 {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 0.25rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

/* ---- Command Output Bar ---- */
#command-output {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 1rem 0;
  margin-bottom: 1rem;
}

.command-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.75rem;
}

.command-bar .prompt {
  color: var(--green);
  font-weight: 700;
  font-size: 1.1rem;
  flex-shrink: 0;
}

#command-display {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  cursor: text;
}

#copy-btn,
#reset-btn {
  background: var(--accent-dim);
  color: #fff;
  border: none;
  border-radius: 4px;
  padding: 0.35rem 0.75rem;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s;
}

#copy-btn:hover {
  background: var(--accent);
}

#reset-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

#reset-btn:hover {
  border-color: var(--text-muted);
  color: var(--text);
}

/* ---- Option Groups ---- */
.option-group {
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem 1.25rem;
  background: var(--surface);
}

.option-group h2 {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
}

.group-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

/* ---- Options Grid ---- */
.options-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 0.4rem;
}

.container {
  display: flex;
  flex-direction: column;
}

.option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  user-select: none;
}

.option:hover {
  background: var(--surface-hover);
}

.option input[type="checkbox"],
.option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--border);
  border-radius: 3px;
  background: var(--bg);
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s, background 0.15s;
}

.option input[type="radio"] {
  border-radius: 50%;
}

.option input[type="checkbox"]:checked,
.option input[type="radio"]:checked {
  background: var(--accent-dim);
  border-color: var(--accent);
}

.option input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 5px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.option input[type="radio"]:checked::after {
  content: "";
  position: absolute;
  top: 3.5px;
  left: 3.5px;
  width: 7px;
  height: 7px;
  background: #fff;
  border-radius: 50%;
}

.flag {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--flag-text);
  background: var(--flag-bg);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
}

.desc {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* ---- Text Inputs ---- */
.input-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.input-row label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--flag-text);
  background: var(--flag-bg);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  white-space: nowrap;
  min-width: fit-content;
}

.input-row input[type="text"] {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.4rem 0.6rem;
  color: var(--text);
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s;
}

.input-row input[type="text"]:focus {
  border-color: var(--accent);
}

.input-row input[type="text"]::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

#target-input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.5rem 0.75rem;
  color: var(--text);
  font-family: inherit;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.15s;
}

#target-input:focus {
  border-color: var(--accent);
}

#target-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--green);
  color: var(--bg);
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: opacity 0.3s;
  pointer-events: none;
}

.toast.hidden {
  opacity: 0;
}

/* ---- Footer ---- */
footer {
  text-align: center;
  padding: 1.5rem;
  color: var(--text-muted);
  font-size: 0.75rem;
  border-top: 1px solid var(--border);
}

a {
  color: inherit;
}

/* ---- Responsive ---- */
@media (max-width: 600px) {
  .options-grid {
    grid-template-columns: 1fr;
  }

  .command-bar {
    flex-wrap: wrap;
  }

  #command-display {
    min-width: 0;
  }
}