/* SDTI 沙雕TI - crude doodle aesthetic */

:root {
  --bg: #fff8e7;
  --paper: #ffffff;
  --ink: #222;
  --accent: #f4a261;
  --accent-2: #ffd23f;
  --soft: #f4e9d0;
  --shadow: 4px 4px 0 #222;
}

* { box-sizing: border-box; }

:root { color-scheme: light; }

html, body { color-scheme: light; }

body {
  margin: 0;
  font-family: "Comic Sans MS", "Marker Felt", "Hiragino Maru Gothic ProN",
               "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  background-image:
    radial-gradient(circle at 20% 30%, #fff5b8 0, transparent 40%),
    radial-gradient(circle at 80% 70%, #ffe0c2 0, transparent 40%);
  color: var(--ink);
  min-height: 100vh;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  width: 100%;
  max-width: 640px;
}

.screen {
  background: var(--paper);
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 32px 28px;
  position: relative;
}

/* ─── Landing ─────────────────────────────────────────────── */
.landing { text-align: center; }

.badge {
  display: inline-block;
  background: var(--accent-2);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 4px 14px;
  font-size: 13px;
  font-weight: bold;
  margin-bottom: 16px;
  transform: rotate(-2deg);
}

.title {
  font-size: 64px;
  font-weight: 900;
  margin: 0 0 4px;
  color: var(--accent);
  text-shadow: 3px 3px 0 var(--ink);
  letter-spacing: 2px;
}

.title .sub {
  display: block;
  font-size: 22px;
  color: var(--ink);
  text-shadow: none;
  margin-top: 6px;
  letter-spacing: 0;
}

.tagline {
  font-size: 17px;
  line-height: 1.7;
  margin: 20px 0;
  color: #444;
}

.warn {
  background: #fff3cd;
  border: 2px dashed var(--ink);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  margin: 20px 0;
  line-height: 1.6;
  transform: rotate(-0.5deg);
}

.btn-big {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 16px 36px;
  font-size: 22px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.1s, box-shadow 0.1s;
  margin: 16px 0 12px;
}

.btn-big:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.btn-big:active {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 var(--ink);
}

.footnote {
  font-size: 12px;
  color: #888;
  margin-top: 20px;
  line-height: 1.5;
}

/* ─── Quiz ────────────────────────────────────────────────── */
.quiz { padding-top: 22px; }

.progress {
  width: 100%;
  height: 14px;
  background: var(--soft);
  border: 2px solid var(--ink);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-bar {
  height: 100%;
  background: var(--accent);
  transition: width 0.3s;
}

.qmeta {
  text-align: right;
  font-size: 13px;
  color: #888;
  margin-bottom: 12px;
}

.qtext {
  font-size: 22px;
  line-height: 1.5;
  margin: 8px 0 22px;
  color: var(--ink);
}

.options {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.option {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--paper);
  border: 2.5px solid var(--ink);
  border-radius: 12px;
  padding: 14px 16px;
  text-align: left;
  font-size: 16px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.15s;
}

.option:hover {
  background: var(--soft);
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 var(--ink);
}

.option.selected {
  background: #fff3d6;
  border-color: #d4a017;
  transform: translate(-2px, -2px);
  box-shadow: 3px 3px 0 #d4a017;
}

.opt-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: var(--ink);
  color: #fff;
  border-radius: 50%;
  font-weight: bold;
  flex-shrink: 0;
}

.opt-text { line-height: 1.5; }

.btn-next {
  display: block;
  width: 100%;
  background: var(--accent);
  color: #fff;
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 14px;
  font-size: 18px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.1s;
}

.btn-next:hover:not(:disabled) {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.btn-next:disabled {
  background: #ccc;
  cursor: not-allowed;
  box-shadow: 2px 2px 0 #888;
}

/* ─── Result ──────────────────────────────────────────────── */
.result { text-align: center; }

.result-card { padding: 0; }

.result-code {
  display: inline-block;
  background: var(--ink);
  color: var(--accent-2);
  border-radius: 8px;
  padding: 4px 14px;
  font-size: 14px;
  font-weight: bold;
  letter-spacing: 1.5px;
  margin-bottom: 14px;
}

.result-avatar {
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
  border: 3px solid var(--ink);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background: #fff;
}

.result-avatar svg {
  width: 100%;
  height: 100%;
  display: block;
}

.result-name {
  font-size: 38px;
  margin: 8px 0 4px;
  color: var(--accent);
  text-shadow: 2px 2px 0 var(--ink);
}

.result-en {
  font-size: 14px;
  color: #888;
  font-style: italic;
  margin-bottom: 14px;
}

.result-tagline {
  font-size: 18px;
  color: var(--ink);
  font-weight: bold;
  margin: 14px 0;
}

.divider {
  margin: 22px 0 12px;
  font-size: 13px;
  color: #888;
  letter-spacing: 1px;
}

.result-roast {
  font-size: 15px;
  line-height: 1.8;
  text-align: left;
  background: var(--soft);
  border: 2px dashed var(--ink);
  border-radius: 10px;
  padding: 16px;
  margin: 0;
}

.verdict {
  background: #ffe0e0;
  border: 2px solid var(--accent);
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
  font-size: 14px;
  line-height: 1.7;
  text-align: left;
  transform: rotate(-0.3deg);
}

.signals {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.sig {
  background: var(--accent-2);
  border: 2px solid var(--ink);
  border-radius: 18px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: bold;
}

.actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 22px;
  flex-wrap: wrap;
}

.btn-share, .btn-restart {
  background: var(--paper);
  color: var(--ink);
  border: 3px solid var(--ink);
  border-radius: 10px;
  padding: 12px 22px;
  font-size: 15px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
  transition: all 0.1s;
}

.btn-share:hover, .btn-restart:hover {
  transform: translate(-2px, -2px);
  box-shadow: 5px 5px 0 var(--ink);
}

.btn-share { background: var(--accent-2); }

/* ─── Verification ────────────────────────────────────────── */
.verify { text-align: center; }

.verify-question {
  font-size: 22px;
  line-height: 1.7;
  margin: 24px 0;
  color: var(--ink);
}

.verify-name {
  display: inline-block;
  background: linear-gradient(180deg, transparent 60%, #ffe4a8 60%);
  padding: 0 6px;
  font-size: 19px;
  color: #b8456c;
  font-weight: bold;
  margin: 8px 0;
  line-height: 1.5;
}

.verify-actions {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 28px;
  flex-wrap: wrap;
}

.btn-yes, .btn-no {
  border: 3px solid var(--ink);
  border-radius: 12px;
  padding: 14px 28px;
  font-size: 17px;
  font-weight: bold;
  font-family: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: all 0.1s;
}

.btn-yes { background: #ffd6e8; color: var(--ink); }
.btn-no  { background: #e0e0e0; color: var(--ink); }

.btn-yes:hover, .btn-no:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.key-input {
  width: 100%;
  padding: 14px 16px;
  font-size: 17px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  border: 3px solid var(--ink);
  border-radius: 12px;
  background: #fff;
  margin: 18px 0 10px;
  outline: none;
  letter-spacing: 1px;
  text-align: center;
}

.key-input:focus {
  background: #fffbe8;
  box-shadow: var(--shadow);
}

.key-input.shake {
  animation: shake 0.4s;
  border-color: #d4504e;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.key-error {
  color: #d4504e;
  font-size: 14px;
  min-height: 22px;
  margin-bottom: 10px;
}

/* ─── Decode animation ────────────────────────────────────── */
.decode-screen { padding: 36px 28px; }

.decode-label {
  font-size: 11px;
  letter-spacing: 2px;
  color: #888;
  margin-top: 14px;
  font-family: "SF Mono", "Menlo", monospace;
}

.decode-line {
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  font-size: 20px;
  letter-spacing: 2px;
  padding: 14px 12px;
  margin: 6px 0;
  border: 2px dashed var(--ink);
  border-radius: 10px;
  background: #fffbe8;
  word-break: break-all;
  text-align: center;
  min-height: 28px;
  transition: opacity 0.6s;
}

.decode-line.encoded { color: #888; }
.decode-line.encoded.faded { opacity: 0.25; }
.decode-line.decoded {
  color: #b8456c;
  font-weight: bold;
  background: #fff0f5;
  border-color: #b8456c;
}

.decode-arrow {
  font-size: 32px;
  color: var(--accent);
  margin: 4px 0;
  animation: bounce 1s infinite;
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

.decode-status {
  margin-top: 18px;
  font-size: 15px;
  color: #888;
  font-weight: bold;
}

.decode-status.success {
  color: #2d8f4e;
  font-size: 18px;
}

/* ─── Rejected ────────────────────────────────────────────── */
.rejected { text-align: center; padding: 50px 28px; }

.big-emoji {
  font-size: 80px;
  margin-bottom: 16px;
}

.reject-text {
  font-size: 28px;
  color: #d4504e;
  text-shadow: 2px 2px 0 var(--ink);
  margin: 14px 0;
  line-height: 1.6;
}

.reject-sub {
  font-size: 14px;
  color: #888;
  margin-top: 22px;
}

/* ─── Mobile ──────────────────────────────────────────────── */
@media (max-width: 500px) {
  .screen { padding: 24px 20px; }
  .title { font-size: 48px; }
  .qtext { font-size: 19px; }
  .result-name { font-size: 30px; }
  .result-avatar { width: 170px; height: 170px; }
  .option { font-size: 15px; }
}
