:root {
  --bg: #000000;
  --text: #e6e8ee;
  --muted: #8b93a7;
  --error: #ff6b6b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font: 11px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  min-height: 100vh;
  position: relative;
}

main {
  /* Center of the block sits at 40vh — 10% above viewport center. */
  position: absolute;
  top: 40vh;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  padding: 24px;
}

.content {
  max-width: 1100px;
  margin: 0 auto;
}

.content > h1 {
  margin: 0 0 56px;
  font-size: clamp(22px, 2.8vw, 32px);
  font-weight: 600;
  text-align: left;
  color: var(--text);
}

.block {
  margin-bottom: 64px;
}

.block:last-child { margin-bottom: 0; }

.block h2 {
  margin: 0 0 20px;
  font-size: clamp(18px, 2vw, 26px);
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.cols {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

@media (max-width: 640px) {
  /* On phones, drop the 40vh offset and let the page flow normally. */
  main {
    position: static;
    transform: none;
    padding: 24px;
  }
  .cols { grid-template-columns: 1fr; }
  .block { margin-bottom: 32px; }
  .content > h1 { margin-bottom: 32px; }
}

.tile h3 {
  margin: 0 0 10px;
  font-size: clamp(12px, 1.1vw, 14px);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.tile p {
  margin: 0;
  font-family: "Roboto Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(58px, 9.6vw, 112px);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1.05;
  word-break: break-word;
}

.empty, .error-msg {
  padding: 16px 0;
  color: var(--muted);
}
.error-msg { color: var(--error); }

/* ---- Settings ---- */

.gear {
  position: fixed;
  bottom: 16px;
  right: 16px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 10;
  transition: color 120ms ease, background 120ms ease, border-color 120ms ease;
}
.gear:hover, .gear:focus-visible {
  color: var(--text);
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  outline: none;
}

.settings {
  background: #14161e;
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 22px;
  max-width: 560px;
  width: calc(100% - 32px);
  font: 13px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.settings::backdrop { background: rgba(0, 0, 0, 0.65); }

.settings h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text);
}
.settings .hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 12px;
}
.settings .hint code {
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: 11px;
}

.settings fieldset {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 10px 14px 14px;
  margin: 0 0 14px;
}
.settings legend {
  padding: 0 6px;
}
.settings legend input {
  background: transparent;
  border: none;
  color: var(--muted);
  font: 600 11px/1 inherit;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  width: 240px;
  padding: 2px 4px;
}
.settings legend input:focus {
  outline: 1px solid rgba(79, 140, 255, 0.5);
  border-radius: 3px;
}

.settings .field-row {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 10px;
  margin-top: 8px;
  align-items: center;
}
.settings .title-row {
  margin: 0 0 16px;
}
.settings .title-row label,
.settings .save-key-row label {
  color: var(--muted);
  font-size: 12px;
  padding-left: 2px;
}
.settings .save-key-row {
  margin-top: 16px;
}

.settings input[type="text"],
.settings input[type="password"] {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 7px 10px;
  color: var(--text);
  font: inherit;
  width: 100%;
  min-width: 0;
}
.settings input[type="text"]:focus,
.settings input[type="password"]:focus {
  outline: none;
  border-color: rgba(79, 140, 255, 0.6);
  background: rgba(255, 255, 255, 0.06);
}

.settings .status {
  margin-top: 14px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12px;
}
.settings .status.error {
  background: rgba(255, 107, 107, 0.1);
  color: var(--error);
  border: 1px solid rgba(255, 107, 107, 0.3);
}
.settings .status.info {
  background: rgba(79, 140, 255, 0.1);
  color: #9ab9ff;
  border: 1px solid rgba(79, 140, 255, 0.3);
}

.settings .actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}
.settings .actions button {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text);
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
  font: inherit;
}
.settings .actions button:hover {
  background: rgba(255, 255, 255, 0.1);
}
.settings .actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.settings .actions #settings-reset {
  margin-right: auto;
  color: var(--muted);
}
.settings .actions #settings-save {
  background: #4f8cff;
  border-color: #4f8cff;
  color: #fff;
}
.settings .actions #settings-save:hover {
  background: #3d76e0;
  border-color: #3d76e0;
}
