/* ================= SpeakUp Phone-frame styles ================= */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background:
    radial-gradient(1100px 700px at 12% 8%, #ffd9c9 0%, transparent 60%),
    radial-gradient(900px 700px at 88% 92%, #c8d4ff 0%, transparent 60%),
    linear-gradient(135deg, #fdf6f0 0%, #eef2ff 100%);
  min-height: 100vh;
  color: #1d1f2a;
  overflow-x: hidden;
}

/* Layout */
.stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 56px;
  min-height: 100vh;
  padding: 32px 24px;
}
.side-intro {
  max-width: 360px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.side-intro .brand { display: flex; align-items: center; gap: 14px; }
.side-intro .logo {
  width: 56px; height: 56px; border-radius: 16px;
  background: linear-gradient(135deg, #ff7a59, #ff4d8b);
  color: #fff; font-weight: 800; font-size: 28px;
  display: grid; place-items: center;
  box-shadow: 0 14px 30px rgba(255,77,139,.35);
}
.side-intro h1 { margin: 0; font-size: 28px; letter-spacing: 1px; }
.side-intro p { margin: 0; color: #6a6f80; font-size: 14px; }
.features { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.features li {
  background: rgba(255,255,255,.7); backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.8);
  padding: 14px 16px; border-radius: 14px;
  display: flex; flex-direction: column; gap: 4px;
  box-shadow: 0 6px 18px rgba(50,60,120,.06);
}
.features b { font-size: 15px; }
.features span { color: #6a6f80; font-size: 13px; }
.side-intro .tip { color: #8a8fa0; font-size: 13px; }

/* Phone */
.phone {
  width: 390px; height: 820px;
  background: #111;
  border-radius: 52px;
  padding: 14px;
  box-shadow: 0 40px 80px rgba(20,20,40,.35), 0 0 0 2px #2a2a2e inset;
  position: relative;
  flex-shrink: 0;
}
.notch {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  width: 130px; height: 30px; background: #000; border-radius: 0 0 18px 18px; z-index: 5;
}
.indicator {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 130px; height: 5px; background: #444; border-radius: 3px;
}
.screen {
  background: #f4f5f8; width: 100%; height: 100%; border-radius: 40px;
  overflow: hidden; display: flex; flex-direction: column;
  position: relative;
}

/* Top bar (status + page title) */
.topbar {
  padding: 14px 22px 8px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; font-weight: 600;
  background: linear-gradient(180deg, #fff 0%, transparent 100%);
  position: relative;
}
.topbar .time { color: #1d1f2a; }
.topbar .title { font-size: 15px; }
.topbar .sig { color: #aaa; font-size: 12px; }

/* View area scrolls */
.view {
  flex: 1; overflow-y: auto;
  padding: 6px 0 92px;
  scroll-behavior: smooth;
}
.view::-webkit-scrollbar { width: 0; }

/* Tab bar */
.tabbar {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(255,255,255,.95); backdrop-filter: blur(12px);
  border-top: 1px solid rgba(0,0,0,.05);
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: 6px 0 14px;
}
.tab {
  background: none; border: none; padding: 8px 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: #9aa0b0; font-size: 11px; cursor: pointer;
  font-family: inherit;
}
.tab .ico { font-size: 20px; line-height: 1; }
.tab.active { color: #ff4d8b; }

/* ========== Components inside view ========== */

/* Hero block on home */
.hero {
  margin: 6px 16px 14px; padding: 18px 18px 16px;
  border-radius: 22px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(135deg, #ff7a59 0%, #ff4d8b 60%, #b14dff 100%);
  box-shadow: 0 18px 40px rgba(255,77,139,.35);
}
.hero h2 { margin: 0 0 4px; font-size: 20px; }
.hero p { margin: 0; opacity: .9; font-size: 13px; }
.hero .badge {
  position: absolute; top: 14px; right: 14px;
  background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.3);
  padding: 3px 8px; border-radius: 99px; font-size: 11px;
}
.hero .cta {
  display: inline-block; margin-top: 12px;
  background: #fff; color: #ff4d8b; font-weight: 700;
  padding: 8px 16px; border-radius: 99px; font-size: 13px;
  border: none; cursor: pointer;
}

/* Section header */
.section-h {
  display: flex; align-items: center; justify-content: space-between;
  margin: 18px 16px 8px;
}
.section-h h3 { margin: 0; font-size: 16px; }
.section-h .more { font-size: 12px; color: #8a8fa0; cursor: pointer; }

/* Category chips */
.chips {
  display: flex; gap: 8px; padding: 4px 16px 6px;
  overflow-x: auto;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex-shrink: 0;
  padding: 7px 14px; border-radius: 99px;
  background: #fff; border: 1px solid #ececf0;
  color: #5a5f6e; font-size: 13px; cursor: pointer; white-space: nowrap;
  font-family: inherit;
}
.chip.active {
  background: linear-gradient(135deg,#ff7a59,#ff4d8b);
  color: #fff; border-color: transparent;
}

/* Scenario card */
.card-list { display: flex; flex-direction: column; gap: 10px; padding: 4px 16px 20px; }
.card {
  background: #fff; border-radius: 16px; padding: 14px;
  box-shadow: 0 4px 14px rgba(50,60,120,.06);
  cursor: pointer;
  transition: transform .15s ease;
}
.card:active { transform: scale(.98); }
.card .head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card .cat {
  font-size: 11px; padding: 2px 8px; border-radius: 99px;
  background: #fff1ec; color: #ff5a40; font-weight: 600;
}
.card .cat.workplace { background: #ecf2ff; color: #4a6dff; }
.card .cat.daily { background: #fff4d6; color: #c6900b; }
.card .cat.family { background: #f3eaff; color: #8c4dff; }
.card .cat.speech { background: #e3f7ed; color: #11a96b; }
.card .tag {
  font-size: 10px; padding: 1px 6px; border-radius: 4px;
  background: #f4f5f8; color: #8a8fa0;
}
.card .diff { margin-left: auto; color: #ffc239; font-size: 12px; letter-spacing: 1px; }
.card h4 { margin: 4px 0; font-size: 15px; line-height: 1.4; }
.card p { margin: 4px 0 0; font-size: 12px; color: #6a6f80; line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Scenario detail */
.detail {
  padding: 0 16px 20px;
}
.detail .back {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 13px; color: #6a6f80; cursor: pointer;
  margin: 4px 0 12px; background: none; border: none; padding: 0;
  font-family: inherit;
}
.detail .scene-card {
  background: linear-gradient(135deg, #fff7f1 0%, #fef0e6 100%);
  border-radius: 16px; padding: 16px; border: 1px solid #ffe1d0;
}
.detail .scene-card .title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.detail .scene-card .roles { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0; }
.detail .scene-card .role {
  font-size: 12px; padding: 3px 8px; border-radius: 99px;
  background: #fff; border: 1px solid #ffd4b8; color: #c0533c;
}
.detail .scene-card .ctx { font-size: 14px; line-height: 1.7; color: #4a4f60; margin-top: 6px; }
.detail .scene-card .goal {
  margin-top: 12px; padding: 10px 12px; background: #fff; border-radius: 10px;
  font-size: 13px; color: #1d1f2a; display: flex; gap: 8px;
}
.detail .scene-card .goal b { color: #ff4d8b; flex-shrink: 0; }

.detail .input-area {
  margin-top: 14px; background: #fff; border-radius: 16px; padding: 14px;
  box-shadow: 0 4px 14px rgba(50,60,120,.06);
}
.detail .input-area label {
  font-size: 13px; color: #6a6f80; display: block; margin-bottom: 8px;
}
.detail .input-area textarea {
  width: 100%; min-height: 130px; border: 1px solid #ececf0; border-radius: 12px;
  padding: 12px; font-size: 14px; line-height: 1.6; resize: none;
  font-family: inherit; background: #fafbfd; color: #1d1f2a; outline: none;
}
.detail .input-area textarea:focus { border-color: #ff4d8b; background: #fff; }
.detail .input-area .meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 8px; font-size: 12px; color: #9aa0b0;
}
.detail .submit {
  width: 100%; margin-top: 12px; padding: 14px;
  background: linear-gradient(135deg,#ff7a59,#ff4d8b);
  border: none; border-radius: 14px; color: #fff; font-size: 15px;
  font-weight: 600; cursor: pointer; font-family: inherit;
  box-shadow: 0 10px 24px rgba(255,77,139,.3);
}
.detail .submit:disabled { opacity: .6; cursor: not-allowed; }

/* AI result */
.result { padding: 14px 16px 20px; }
.result-card {
  background: #fff; border-radius: 16px; padding: 16px;
  box-shadow: 0 4px 14px rgba(50,60,120,.06); margin-bottom: 12px;
}
.scores {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
}
.score-item {
  background: linear-gradient(135deg, #fff7f1, #fef0e6);
  border-radius: 12px; padding: 10px 12px;
}
.score-item .label { font-size: 11px; color: #c0533c; }
.score-item .val { font-size: 22px; font-weight: 800; color: #1d1f2a; }
.score-total {
  margin-top: 10px; padding: 14px;
  background: linear-gradient(135deg,#ff7a59,#ff4d8b);
  color: #fff; border-radius: 14px; text-align: center;
}
.score-total .label { font-size: 12px; opacity: .9; }
.score-total .val { font-size: 36px; font-weight: 800; line-height: 1; margin-top: 4px; }

.feedback h5 { margin: 12px 0 6px; font-size: 14px; color: #4a4f60; display: flex; align-items: center; gap: 6px; }
.feedback h5 .dot { width: 6px; height: 6px; border-radius: 99px; background: #ff4d8b; display: inline-block; }
.feedback p { margin: 0; font-size: 13px; line-height: 1.7; color: #1d1f2a; }
.highlight-box {
  background: #e3f7ed; border-radius: 10px; padding: 10px 12px;
  font-size: 13px; color: #11a96b; line-height: 1.6;
}
.improve-box {
  background: #fff1ec; border-radius: 10px; padding: 10px 12px;
  font-size: 13px; color: #d33b18; line-height: 1.6;
}

.method-box {
  background: linear-gradient(135deg,#eef2ff,#e8e6ff);
  border-radius: 12px; padding: 12px;
}
.method-box .name { font-weight: 700; font-size: 14px; color: #5a3dff; margin-bottom: 6px; }
.method-box ol { margin: 4px 0 6px; padding-left: 20px; font-size: 13px; line-height: 1.7; }
.method-box .key { font-size: 12px; color: #6a6f80; font-style: italic; }

.demos { display: flex; flex-direction: column; gap: 8px; }
.demo {
  background: #fafbfd; border: 1px solid #ececf0; border-radius: 12px;
  padding: 10px 12px;
}
.demo .tone {
  display: inline-block; font-size: 11px; padding: 1px 8px; border-radius: 99px;
  background: #fff1ec; color: #ff5a40; margin-bottom: 6px;
}
.demo p { margin: 0; font-size: 13px; line-height: 1.6; }

.followup {
  background: #fff8e1; border-left: 3px solid #ffc239;
  padding: 10px 12px; border-radius: 8px; font-size: 13px; line-height: 1.6;
}

/* Custom input page */
.custom { padding: 14px 16px 20px; }
.custom .hero {
  margin: 0 0 14px;
  background: linear-gradient(135deg, #5a3dff 0%, #b14dff 60%, #ff4d8b 100%);
  box-shadow: 0 18px 40px rgba(90,61,255,.3);
}
.custom .form { background: #fff; border-radius: 16px; padding: 14px; box-shadow: 0 4px 14px rgba(50,60,120,.06); }
.custom .form label { font-size: 13px; color: #6a6f80; margin: 10px 0 6px; display: block; }
.custom .form label:first-child { margin-top: 0; }
.custom .form textarea, .custom .form input {
  width: 100%; border: 1px solid #ececf0; border-radius: 12px;
  padding: 12px; font-size: 14px; line-height: 1.6;
  font-family: inherit; background: #fafbfd; color: #1d1f2a; outline: none;
}
.custom .form textarea { min-height: 100px; resize: none; }
.custom .form textarea:focus, .custom .form input:focus { border-color: #ff4d8b; background: #fff; }
.custom .submit {
  width: 100%; margin-top: 14px; padding: 14px;
  background: linear-gradient(135deg,#5a3dff,#ff4d8b);
  border: none; border-radius: 14px; color: #fff; font-size: 15px;
  font-weight: 600; cursor: pointer; font-family: inherit;
  box-shadow: 0 10px 24px rgba(90,61,255,.3);
}
.custom .submit:disabled { opacity: .6; cursor: not-allowed; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tags .t {
  font-size: 11px; padding: 3px 8px; border-radius: 99px;
  background: #f3eaff; color: #8c4dff;
}

/* Me page */
.me { padding: 14px 16px 20px; }
.profile-card {
  background: linear-gradient(135deg, #1d1f2a 0%, #2d3046 100%);
  color: #fff; border-radius: 18px; padding: 18px; position: relative; overflow: hidden;
}
.profile-card::after {
  content: ''; position: absolute; top: -40px; right: -40px; width: 160px; height: 160px;
  background: radial-gradient(circle, rgba(255,77,139,.4) 0%, transparent 70%);
  border-radius: 50%;
}
.profile-card .name { font-size: 18px; font-weight: 700; }
.profile-card .sub { font-size: 12px; opacity: .7; margin-top: 4px; }
.stat-row { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin: 14px 0 0; }
.stat-row .stat { background: rgba(255,255,255,.08); border-radius: 12px; padding: 10px; text-align: center; }
.stat-row .stat .v { font-size: 22px; font-weight: 800; }
.stat-row .stat .l { font-size: 11px; opacity: .7; margin-top: 2px; }

.radar-card {
  background: #fff; border-radius: 16px; padding: 14px; margin-top: 12px;
  box-shadow: 0 4px 14px rgba(50,60,120,.06);
}
.radar-card h4 { margin: 0 0 8px; font-size: 15px; }
canvas.radar { width: 100% !important; height: 220px !important; display: block; }

.history-card {
  background: #fff; border-radius: 16px; padding: 14px; margin-top: 12px;
  box-shadow: 0 4px 14px rgba(50,60,120,.06);
}
.history-card h4 { margin: 0 0 8px; font-size: 15px; }
.h-item {
  border-bottom: 1px solid #f0f0f4; padding: 10px 0;
  display: flex; justify-content: space-between; gap: 10px;
}
.h-item:last-child { border-bottom: none; }
.h-item .ti { font-size: 13px; line-height: 1.4; flex: 1;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.h-item .sc { font-size: 16px; font-weight: 800; color: #ff4d8b; flex-shrink: 0; }
.h-item .date { font-size: 11px; color: #9aa0b0; margin-top: 4px; }

/* Library page */
.library { padding: 14px 16px 20px; }
.lib-item {
  background: #fff; border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
  box-shadow: 0 4px 12px rgba(50,60,120,.05);
}
.lib-item h4 { margin: 0 0 6px; font-size: 14px; color: #5a3dff; }
.lib-item .steps { font-size: 12px; line-height: 1.7; color: #4a4f60; padding-left: 18px; margin: 0; }
.lib-item .src { font-size: 11px; color: #9aa0b0; margin-top: 6px; }

/* Loading */
.loading {
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  padding: 36px 20px; color: #6a6f80; font-size: 13px;
}
.spinner {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid #f0f0f4; border-top-color: #ff4d8b;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Empty */
.empty { text-align: center; padding: 40px 20px; color: #9aa0b0; font-size: 13px; }
.empty .ic { font-size: 40px; margin-bottom: 8px; }

/* Toast */
.toast {
  position: fixed; bottom: 32px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: rgba(0,0,0,.85); color: #fff; padding: 10px 18px; border-radius: 99px;
  font-size: 13px; opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Mobile responsive */
@media (max-width: 900px) {
  .side-intro { display: none; }
  .stage { padding: 0; }
  .phone {
    width: 100vw; height: 100vh;
    border-radius: 0; padding: 0; box-shadow: none;
  }
  .phone .notch, .phone .indicator { display: none; }
  .screen { border-radius: 0; }
  body { background: #f4f5f8; }
}
