:root {
  color-scheme: light;
  --paper: #f5f1e9;
  --surface: #fffdf9;
  --ink: #203f37;
  --muted: #5f756f;
  --green: #315f52;
  --green-dark: #284f45;
  --orange: #aa6635;
  --border: rgba(49, 95, 82, 0.14);
  --shadow: 0 24px 70px rgba(37, 68, 58, 0.12);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 92% 2%, rgba(229, 169, 104, 0.19), transparent 28rem),
    radial-gradient(circle at 4% 98%, rgba(59, 123, 104, 0.14), transparent 30rem),
    var(--paper);
}

button, select { font: inherit; }
a { color: inherit; }

.shell { min-height: 100vh; padding: 28px 16px 48px; }
.shell--center { display: grid; place-items: center; }
.page-wrap { width: min(100%, 672px); margin: 0 auto; }
.page-wrap--narrow { width: min(100%, 560px); }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--green);
  font-size: 14px;
  font-weight: 750;
  letter-spacing: .03em;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--green);
}

.pill {
  padding: 5px 10px;
  border: 1px solid rgba(49, 95, 82, .2);
  border-radius: 999px;
  color: var(--green);
  background: rgba(255, 255, 255, .56);
  font-size: 12px;
  font-weight: 700;
}

.prompt-card, .home-card, .tool-card, .message-card {
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .78);
  border-radius: 28px;
  background: rgba(255, 253, 249, .92);
  box-shadow: var(--shadow);
}

.home-card { width: min(100%, 660px); padding: 42px; }
.tool-card { padding: 30px; }
.message-card { padding: 48px 28px; text-align: center; color: var(--muted); }
.message-card h1 { margin: 14px 0 8px; color: var(--ink); font-size: 22px; }
.message-card p { margin: 0 auto; max-width: 420px; font-size: 14px; line-height: 1.75; }

.error-icon {
  display: grid;
  width: 48px;
  height: 48px;
  margin: 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #a75d2d;
  background: #fff1e5;
  font-size: 20px;
  font-weight: 800;
}

.prompt-card__header { padding: 30px 34px; border-bottom: 1px solid var(--border); }
.prompt-card__body { padding: 28px 34px; }
.eyebrow { margin: 0 0 12px; color: var(--orange); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(28px, 6vw, 38px); line-height: 1.3; letter-spacing: -.02em; }
.lead { margin: 13px 0 0; color: var(--muted); font-size: 15px; line-height: 1.8; }

.prompt-text {
  max-height: 48vh;
  margin: 0 0 24px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 22px;
  color: #2d4941;
  background: #f7f4ed;
  font: inherit;
  font-size: 15px;
  line-height: 1.85;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: transform .15s ease, background .15s ease;
}

.button:hover { transform: translateY(-1px); }
.button:focus-visible, .select:focus-visible { outline: 3px solid rgba(49, 95, 82, .3); outline-offset: 2px; }
.button--primary { color: white; background: var(--green); }
.button--primary:hover { background: var(--green-dark); }
.button--secondary { color: var(--green); border-color: var(--border); background: white; }
.button--large { min-height: 56px; border-radius: 17px; font-size: 16px; }
.button--full { width: 100%; }
.button-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 16px 0 12px; }
.home-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }

.status { min-height: 20px; margin: 14px 0 0; color: #4d6d64; text-align: center; font-size: 13px; font-weight: 650; }
.status--error { color: #a13636; }

.field-label { display: block; margin: 26px 0 8px; font-size: 14px; font-weight: 750; }
.select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 8px 12px;
  color: var(--ink);
  background: white;
}

.qr-frame { width: 188px; max-width: 55vw; margin: 18px auto 0; border: 1px solid var(--border); border-radius: 16px; padding: 8px; background: white; }
.qr-frame canvas { display: block; width: 100% !important; height: auto !important; }
.qr-caption { margin: 8px 0 14px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.5; }
.share-url { overflow-wrap: anywhere; border-radius: 12px; padding: 12px; color: #4f655e; background: #f3f1eb; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; line-height: 1.6; }
.clipboard-helper { position: fixed; top: -9999px; opacity: 0; }

[hidden] { display: none !important; }

@media (min-width: 640px) {
  .shell { padding: 48px 24px 72px; }
  .prompt-text { max-height: none; }
}

@media (max-width: 520px) {
  .home-card, .tool-card { padding: 28px 22px; }
  .prompt-card__header, .prompt-card__body { padding: 26px 22px; }
  .button-grid { grid-template-columns: 1fr; }
  .home-actions .button { width: 100%; }
}
