:root {
  color-scheme: dark;
  --bg: #040b07;
  --panel: #09150e;
  --panel-2: #0d1d13;
  --line: #24442d;
  --line-strong: #3b7a48;
  --text: #eff8f0;
  --muted: #94aa9a;
  --green: #6df05e;
  --green-dark: #2fc969;
  --red: #ff5f68;
  --warning: #f0c95e;
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

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

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input { font: inherit; letter-spacing: 0; }

button { touch-action: manipulation; }

[hidden] { display: none !important; }

.app-shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 20px 0 max(24px, env(safe-area-inset-bottom));
}

.app-header {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  text-decoration: none;
}

.brand img {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 0 22px rgba(109, 240, 94, 0.13);
}

.brand span { display: grid; gap: 2px; }
.brand strong { font-size: 1.08rem; }
.brand small { color: var(--muted); font-weight: 700; }

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.status-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 0;
}

.status-strip span {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #07110b;
  color: var(--muted);
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgba(109, 240, 94, 0.7);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(360px, 1.1fr);
  gap: 16px;
  align-items: stretch;
}

.generator-panel,
.result-panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 22px;
}

.result-panel {
  display: flex;
  flex-direction: column;
  background: var(--panel-2);
}

.panel-heading { margin-bottom: 18px; }
.panel-heading p { margin: 0 0 5px; color: var(--green); font-size: 0.72rem; font-weight: 900; text-transform: uppercase; }
.panel-heading h1,
.panel-heading h2 { margin: 0; font-size: 2rem; line-height: 1.08; letter-spacing: 0; }

form { display: grid; gap: 8px; }

label,
.password-label {
  margin-top: 7px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 850;
}

label span { color: var(--muted); font-weight: 650; }

input {
  width: 100%;
  min-width: 0;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  background: #030b06;
  color: var(--text);
  padding: 12px 13px;
}

input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(109, 240, 94, 0.1);
}

.number-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 7px;
}

.number-options > div { display: grid; gap: 8px; }
.number-options label { margin-top: 0; }
.number-options input { font-variant-numeric: tabular-nums; }

.password-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  padding: 4px;
}

.character-options {
  min-width: 0;
  margin: 12px 0 0;
  border: 0;
  padding: 0;
}

.character-options legend {
  margin-bottom: 9px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 850;
}

.character-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.character-grid label {
  min-height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #030b06;
  cursor: pointer;
  padding: 9px;
}

.character-grid label:has(input:checked) {
  border-color: var(--line-strong);
  background: rgba(109, 240, 94, 0.08);
}

.character-grid input {
  width: 17px;
  min-height: 17px;
  height: 17px;
  margin: 0;
  padding: 0;
  accent-color: var(--green);
}

.character-grid span {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
}

.recipe {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
}

.recipe span {
  min-height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #07120b;
  color: var(--text);
  padding: 7px;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 850;
}

.recipe b { color: var(--green); }

.primary-button,
.secondary-button {
  min-height: 46px;
  border-radius: 7px;
  cursor: pointer;
  font-weight: 900;
  padding: 0 16px;
}

.primary-button {
  border: 1px solid #8cff79;
  background: var(--green);
  color: #041007;
  box-shadow: 0 12px 28px rgba(47, 201, 105, 0.18);
}

.primary-button:hover,
.primary-button:focus-visible { background: #86fa75; outline: none; }

.secondary-button {
  border: 1px solid var(--line-strong);
  background: #07170d;
  color: var(--text);
}

.secondary-button:hover,
.secondary-button:focus-visible { border-color: var(--green); background: rgba(109, 240, 94, 0.08); outline: none; }

.secondary-button:disabled { cursor: not-allowed; opacity: 0.42; }

.status-message {
  min-height: 42px;
  margin: 14px 0 0;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.82rem;
}

.status-message[data-kind="warning"] { border-color: #6e5a22; color: var(--warning); }
.status-message[data-kind="success"] { border-color: var(--line-strong); color: #bafab4; }

.password-output {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.password-output input { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

.qr-toggle-button {
  width: 100%;
  margin-top: 12px;
}

.qr-panel,
.qr-placeholder {
  flex: 1;
  min-height: 330px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #041009;
  padding: 18px;
  text-align: center;
}

.qr-panel canvas {
  width: min(246px, 100%);
  height: auto;
  aspect-ratio: 1;
  border: 8px solid #fff;
  background: #fff;
  image-rendering: pixelated;
}

.qr-panel p,
.qr-placeholder p { max-width: 330px; margin: 0; color: var(--muted); font-size: 0.8rem; }

.qr-placeholder span {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line-strong);
  color: var(--green);
  font-weight: 950;
}

.app-footer {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid var(--line);
  margin-top: 16px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 750;
}

@media (max-width: 760px) {
  .app-shell { width: min(100% - 20px, 560px); padding-top: 10px; }
  .workspace { grid-template-columns: 1fr; }
  .panel-heading h1,
  .panel-heading h2 { font-size: 1.65rem; }
  .qr-panel,
  .qr-placeholder { min-height: 290px; }
}

@media (max-width: 430px) {
  .app-header { align-items: flex-start; }
  .header-actions { align-items: stretch; flex-direction: column; }
  .header-link { min-height: 42px; padding: 0 12px; font-size: 0.76rem; }
  .brand img { width: 42px; height: 42px; }
  .generator-panel,
  .result-panel { padding: 16px; }
  .password-output { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .password-output input { grid-column: 1 / -1; }
  .recipe { grid-template-columns: 1fr; }
  .recipe b { text-align: center; }
  .character-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-footer { align-items: flex-start; flex-direction: column; justify-content: center; padding-top: 12px; }
}
