:root {
  --sea: #0a6e7d;
  --sea-dark: #064a54;
  --sand: #f4efe4;
  --coral: #c45c4a;
  --ink: #1a2330;
  --muted: #5a6b7a;
  --card: #ffffff;
  --radius: 14px;
  --shadow: 0 20px 50px rgba(10, 30, 45, 0.12);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Noto Sans SC", "DM Sans", system-ui, sans-serif;
  color: var(--ink);
  background: var(--sand);
  line-height: 1.6;
}

.bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: linear-gradient(165deg, #e8f4f2 0%, #f4efe4 40%, #dfeaf0 100%);
  pointer-events: none;
}

.header {
  position: relative;
  z-index: 1;
  padding: 1.5rem 1.25rem 0.5rem;
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.logo {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.logo-mark {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--sea), var(--sea-dark));
  color: #fff;
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  font-family: "DM Sans", sans-serif;
  box-shadow: 0 8px 20px rgba(6, 74, 84, 0.35);
}

h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
}

.sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  max-width: 36ch;
}

.link-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: #fff;
  color: var(--sea-dark);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid rgba(10, 110, 125, 0.2);
  transition: background 0.2s, border-color 0.2s;
}

.link-pill:hover {
  background: #f0f9f7;
  border-color: var(--sea);
}

.main {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem 1.5rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(26, 35, 48, 0.06);
}

h2 {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--sea-dark);
}

.hint {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.key-warning {
  margin: 0.75rem 0 0;
  font-size: 0.86rem;
  color: #5c3d0c;
  background: #fff4e0;
  padding: 0.6rem 0.8rem;
  border-radius: 10px;
  border: 1px solid #e8c88a;
}

.field {
  display: block;
  margin-bottom: 1rem;
}

.field > span {
  display: block;
  font-size: 0.88rem;
  font-weight: 500;
  margin-bottom: 0.4rem;
}

.field em {
  font-style: normal;
  font-weight: 400;
  color: var(--muted);
  font-size: 0.82rem;
}

input,
textarea {
  width: 100%;
  font: inherit;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid #cfd6dd;
  background: #fcfcfc;
  color: var(--ink);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--sea);
  box-shadow: 0 0 0 3px rgba(10, 110, 125, 0.15);
}

textarea {
  resize: vertical;
  min-height: 3.2rem;
}

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 640px) {
  .row {
    grid-template-columns: 1fr;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 0.25rem;
}

.btn {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 0.6rem 1.25rem;
  font-weight: 600;
}

.btn.primary {
  background: linear-gradient(135deg, var(--sea), #088598);
  color: #fff;
  box-shadow: 0 10px 25px rgba(6, 74, 84, 0.28);
  transition: transform 0.15s, box-shadow 0.2s;
}

.btn.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 12px 30px rgba(6, 74, 84, 0.35);
}

.btn.primary:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

.status {
  font-size: 0.88rem;
  color: var(--muted);
}

.status.error {
  color: var(--coral);
}

.answer {
  color: #2c3540;
  font-size: 0.95rem;
}

.answer :is(p, ul, ol) {
  margin: 0 0 0.75em;
}

.answer h3,
.answer h4 {
  margin: 1em 0 0.4em;
  font-size: 1em;
  color: var(--sea-dark);
}

.answer h3:first-child,
.answer h4:first-child {
  margin-top: 0;
}

.answer ul,
.answer ol {
  padding-left: 1.3em;
}

.answer code {
  font-size: 0.9em;
  background: #f0f4f7;
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

.result-card[hidden] {
  display: none;
}

.footer {
  position: relative;
  z-index: 1;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem 2rem;
}

.footer p {
  margin: 0;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
}
