/* =========
   Base Theme
   ========= */
:root {
  --bg: #0c111b;
  --bg-elev: #111728;
  --card: #141b2e;
  --border: #233055;
  --text: #eef1ff;
  --muted: #95a0c3;
  --accent: #ffb703;      /* primary accent */
  --accent-2: #2ec4b6;    /* secondary accent */
  --shadow: 0 20px 60px rgba(0, 0, 0, .45);
  --radius: 16px;
  --radius-sm: 12px;
  --gap: 14px;
  --focus: 0 0 0 3px rgba(255, 183, 3, 0.25);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Inter, Ubuntu, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 800px at 80% -10%, #1a2235 0%, #0e1424 55%, #0b1020 100%),
    var(--bg);
  display: grid;
  place-items: center;
  padding: 24px;
}

/* =========
   App Shell
   ========= */
.app {
  width: 100%;
  max-width: 780px;
  background: linear-gradient(180deg, #161d31 0%, #111728 100%);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 22px;
}

.app__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--gap);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand__logo {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #0e1324;
  background: conic-gradient(from 210deg, var(--accent), #ffd166, var(--accent));
  border-radius: 12px;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, .25), 0 6px 20px rgba(0, 0, 0, .3);
}
.brand__title {
  font-size: 20px;
  margin: 0;
}
.brand__muted {
  color: var(--muted);
  font-size: 13px;
  margin: 4px 0 0 0;
}

/* =========
   Status Bar
   ========= */
.status {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #0f1528;
  border: 1px solid var(--border);
  font-size: 13px;
  margin-bottom: 12px;
}
.dot { width: 10px; height: 10px; border-radius: 999px; background: #6b7280; }
.dot.ok { background: var(--accent-2); }
.dot.warn { background: #ff9f1c; }
.dot.err { background: #ef476f; }
.spinner {
  width: 18px; height: 18px;
  border: 3px solid #2c355c;
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =========
   Controls
   ========= */
.controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: var(--gap);
  align-items: end;
  margin: 12px 0 16px;
}
@media (max-width: 720px) {
  .controls {
    grid-template-columns: 1fr 1fr;
  }
  .buttons {
    grid-column: 1 / -1;
    justify-content: start;
  }
}

.field { display: grid; gap: 8px; }
.label { font-size: 12px; color: var(--muted); }
.label__hint { opacity: .8; }

.input {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: #0f1528;
  border: 1px solid var(--border);
  color: var(--text);
}
.input svg { color: #7f88b6; }
.input input {
  appearance: none;
  background: transparent;
  border: 0;
  outline: 0;
  color: var(--text);
  font-size: 14px;
  width: 100%;
}

.select {
  appearance: none;
  background: #0f1528;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px;
}

.buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  appearance: none;
  border: 0;
  outline: 0;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  color: #0f1220;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(180deg, var(--accent) 0%, #ffb703 100%);
  box-shadow: 0 6px 18px rgba(255, 159, 28, .35);
  transition: transform .06s ease, filter .15s ease;
}
.btn:hover { filter: brightness(1.03); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }

.btn--secondary {
  background: linear-gradient(180deg, #6ec6ff 0%, var(--accent-2) 100%);
  color: #04121a;
  box-shadow: 0 6px 18px rgba(110,198,255,.25);
}
.btn--ghost {
  background: transparent;
  color: var(--muted);
  border: 1px dashed #2a3358;
  box-shadow: none;
}

/* =========
   Card / Output
   ========= */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  position: relative;
  overflow: hidden;
}
.joke {
  font-size: 18px;
  line-height: 1.6;
  margin: 0 0 10px;
  white-space: pre-wrap;    /* preserves stand-up paragraphs */
  word-wrap: break-word;
  transition: opacity .25s ease;
  max-height: 38vh;
  overflow-y: auto;
}
.chiprow { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  font-size: 12px; color: #0b1422;
  background: linear-gradient(180deg, #bde0fe 0%, #a0c4ff 100%);
  border-radius: 999px; padding: 6px 10px;
  border: 1px solid rgba(255,255,255,.2)
}
.card__actions { display: flex; gap: 8px; margin-top: 12px; }

/* =========
   Footer
   ========= */
.app__footer {
  margin-top: 16px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.link {
  color: #a3b1ff;
  text-decoration: none;
  font-size: 13px;
}
.link:hover { text-decoration: underline; }
.hint { font-size: 12px; color: var(--muted); }

/* =========
   Focus & Motion
   ========= */
:focus-visible { outline: none; box-shadow: var(--focus); }

@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
  .joke { transition: none; }
  .btn:active { transform: none; }
}
