:root {
  --paper: #f4ead8;
  --paper-deep: #e7d6bc;
  --wall-red: #7f1f1f;
  --wall-red-soft: #a2443a;
  --stone-green: #4f7764;
  --stone-green-deep: #2f5148;
  --ink: #261714;
  --gold: #b78a3d;
  --gold-light: #dbbf7b;
  --like-blue: #4b6cb7;
  --dislike-red: #a62c2b;
  --shadow: 0 18px 40px rgba(49, 22, 17, 0.15);
  --border: 1px solid rgba(120, 59, 42, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Songti SC", "STSong", "Noto Serif CJK SC", "Source Han Serif SC", serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top, rgba(183, 138, 61, 0.14), transparent 30%),
    linear-gradient(180deg, #d8c1a3 0%, #efe3cd 38%, #e9dac1 100%);
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

.page-shell {
  position: relative;
  width: min(1360px, calc(100% - 32px));
  margin: 24px auto;
  padding: 28px;
  border: 1px solid rgba(147, 103, 48, 0.45);
  border-radius: 28px;
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(255, 248, 236, 0.92), rgba(239, 227, 205, 0.96)),
    var(--paper);
  box-shadow: var(--shadow);
}

.page-shell::before,
.page-shell::after {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(183, 138, 61, 0.5);
  border-radius: 20px;
  pointer-events: none;
}

.page-shell::after {
  inset: 22px;
  border-style: dashed;
  opacity: 0.4;
}

.paper-overlay {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(0deg, rgba(255, 255, 255, 0.05), rgba(38, 23, 20, 0.03)),
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.3), transparent 26%),
    radial-gradient(circle at 80% 30%, rgba(120, 63, 43, 0.09), transparent 24%),
    radial-gradient(circle at 60% 80%, rgba(79, 119, 100, 0.08), transparent 20%);
  mix-blend-mode: multiply;
  opacity: 0.85;
  pointer-events: none;
}

.hero,
.layout,
.panel-actions,
.panel-result {
  position: relative;
  z-index: 1;
}

.hero {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 24px;
  padding: 8px 0 28px;
  border-bottom: var(--border);
}

.eyebrow,
.section-kicker {
  margin: 0 0 8px;
  color: var(--wall-red);
  letter-spacing: 0.16em;
  font-size: 0.82rem;
  text-transform: uppercase;
}

canvas,
.export-card img {
  image-rendering: auto;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.3rem, 4vw, 4rem);
  line-height: 1.05;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.35rem, 2vw, 1.8rem);
}

.hero-text,
.panel-actions p,
.export-result p {
  max-width: 700px;
  line-height: 1.8;
  color: rgba(38, 23, 20, 0.8);
}

.hero-stats {
  display: grid;
  gap: 16px;
  align-content: center;
}

.stat-card,
.panel,
.export-card {
  background: linear-gradient(180deg, rgba(255, 251, 244, 0.88), rgba(232, 219, 195, 0.8));
  border: 1px solid rgba(146, 97, 55, 0.2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 14px 28px rgba(81, 43, 29, 0.08);
}

.stat-card {
  padding: 20px;
  border-radius: 22px;
}

.stat-label {
  display: block;
  margin-bottom: 8px;
  color: rgba(38, 23, 20, 0.68);
}

.stat-card strong {
  font-size: 2rem;
  color: var(--stone-green-deep);
}

.layout {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 24px;
  padding: 28px 0;
}

.panel {
  padding: 24px;
  border-radius: 24px;
}

.role-list {
  display: grid;
  gap: 16px;
}

.role-card {
  padding: 18px 18px 16px;
  border-radius: 20px;
  background: rgba(255, 250, 242, 0.7);
  border: 1px solid rgba(147, 103, 48, 0.18);
}

.role-topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: baseline;
  margin-bottom: 12px;
}

.role-name {
  font-size: 1.1rem;
  font-weight: 700;
}

.role-score {
  color: var(--stone-green-deep);
  font-weight: 700;
}

.slider-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.slider-tag {
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  color: rgba(38, 23, 20, 0.58);
}

input[type="range"] {
  width: 100%;
  appearance: none;
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--like-blue), var(--wall-red-soft));
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 247, 230, 0.95);
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 10px rgba(49, 22, 17, 0.28);
  cursor: pointer;
}

input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid rgba(255, 247, 230, 0.95);
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  box-shadow: 0 4px 10px rgba(49, 22, 17, 0.28);
  cursor: pointer;
}

.bottle-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.bottle-card {
  padding: 12px 6px 10px;
  border-radius: 18px;
  text-align: center;
  background:
    linear-gradient(180deg, rgba(255, 251, 243, 0.88), rgba(233, 219, 194, 0.74));
  border: 1px solid rgba(147, 103, 48, 0.2);
}

.bottle {
  position: relative;
  width: 64px;
  height: 122px;
  margin: 0 auto 4px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.bottle-neck {
  position: absolute;
  top: 8px;
  width: 24px;
  height: 16px;
  border-radius: 10px 10px 4px 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(223, 212, 194, 0.75));
  border: 2px solid rgba(118, 88, 66, 0.3);
  z-index: 3;
}

.bottle-body {
  position: absolute;
  bottom: 0;
  width: 64px;
  height: 96px;
  border-radius: 20px 20px 24px 24px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.08));
  border: 3px solid rgba(118, 88, 66, 0.28);
  box-shadow: inset 0 0 0 1px rgba(255, 251, 245, 0.46);
}

.bottle-like,
.bottle-dislike {
  position: absolute;
  left: 0;
  width: 100%;
  transition: height 240ms ease;
}

.bottle-like {
  bottom: 0;
  background:
    linear-gradient(180deg, rgba(123, 176, 255, 0.9), rgba(67, 104, 187, 0.96)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.24), transparent 60%);
}

.bottle-dislike {
  top: 0;
  background:
    linear-gradient(180deg, rgba(172, 39, 37, 0.96), rgba(226, 94, 82, 0.82)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.18), transparent 65%);
}

.bottle-shine {
  position: absolute;
  top: 24px;
  left: 14px;
  width: 8px;
  height: 62px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), transparent);
  z-index: 2;
  opacity: 0.75;
}

.bottle-name {
  margin-bottom: 2px;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.2;
}

.bottle-values {
  display: grid;
  gap: 1px;
  font-size: 0.68rem;
  color: rgba(38, 23, 20, 0.66);
  line-height: 1.2;
}

.panel-actions,
.panel-result,
.panel-ai {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
  margin-bottom: 24px;
}

.panel-result,
.panel-ai {
  align-items: flex-start;
  flex-direction: column;
}

.panel-ai {
  gap: 22px;
}

.action-buttons {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.primary-btn,
.ghost-btn,
.download-btn {
  padding: 14px 24px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease;
}

.primary-btn,
.download-btn {
  background: linear-gradient(135deg, var(--stone-green), var(--stone-green-deep));
  color: #fff9f0;
  box-shadow: 0 14px 24px rgba(47, 81, 72, 0.22);
}

.ghost-btn {
  background: rgba(255, 250, 242, 0.76);
  color: var(--wall-red);
  border: 1px solid rgba(127, 31, 31, 0.2);
}

.primary-btn:hover,
.ghost-btn:hover,
.download-btn:hover {
  transform: translateY(-1px);
}

.export-result {
  width: 100%;
  min-height: 220px;
  padding: 22px;
  border-radius: 20px;
  background: rgba(255, 250, 242, 0.55);
  border: 1px dashed rgba(147, 103, 48, 0.32);
}

.export-result.empty {
  display: flex;
  align-items: center;
}

.export-card {
  width: 100%;
  padding: 18px;
  border-radius: 20px;
}

.export-card img {
  display: block;
  width: min(100%, 920px);
  margin: 0 auto 18px;
  border-radius: 16px;
  border: 1px solid rgba(147, 103, 48, 0.22);
}

.export-meta {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-note {
  margin: 0;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(79, 119, 100, 0.08);
  border: 1px solid rgba(79, 119, 100, 0.14);
  color: rgba(38, 23, 20, 0.78);
}

.analysis-result {
  width: 100%;
  min-height: 220px;
  padding: 22px;
  border-radius: 20px;
  background: rgba(255, 250, 242, 0.55);
  border: 1px dashed rgba(79, 119, 100, 0.32);
}

.analysis-result.empty,
.analysis-result.loading {
  display: flex;
  align-items: center;
}

.analysis-card {
  display: grid;
  gap: 18px;
}

.analysis-card h3,
.analysis-card h4,
.analysis-card p {
  margin-bottom: 0;
}

.analysis-summary {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(79, 119, 100, 0.08);
  border: 1px solid rgba(79, 119, 100, 0.12);
}

.analysis-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.analysis-block {
  padding: 16px 18px;
  border-radius: 18px;
  background: rgba(255, 251, 244, 0.92);
  border: 1px solid rgba(147, 103, 48, 0.14);
}

.analysis-block h4 {
  margin-bottom: 10px;
}

.analysis-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.8;
  color: rgba(38, 23, 20, 0.84);
}

.analysis-footer {
  font-size: 0.92rem;
  color: rgba(38, 23, 20, 0.6);
}

.analysis-error {
  color: var(--wall-red);
}

.fallback-textarea {
  width: 100%;
  min-height: 220px;
  margin-top: 10px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid rgba(147, 103, 48, 0.18);
  background: rgba(255, 251, 244, 0.92);
  color: var(--ink);
  line-height: 1.7;
  resize: vertical;
}

.fallback-actions {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

@media (max-width: 1080px) {
  .hero,
  .layout,
  .panel-actions {
    grid-template-columns: 1fr;
    display: grid;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100% - 16px, 100%);
    padding: 18px;
    margin: 8px auto;
    border-radius: 18px;
  }

  .panel {
    padding: 18px;
  }

  .panel-preview {
    padding: 16px 14px;
  }

  .slider-row {
    grid-template-columns: 1fr;
  }

  .slider-tag {
    display: none;
  }

  .analysis-grid {
    grid-template-columns: 1fr;
  }

  .export-meta {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 420px) {
  .bottle-grid {
    gap: 8px;
  }

  .bottle-card {
    padding: 8px 2px;
  }

  .bottle {
    width: 56px;
    height: 108px;
    margin-bottom: 2px;
  }

  .bottle-body {
    width: 56px;
    height: 84px;
  }

  .bottle-neck {
    width: 20px;
    height: 14px;
  }

  .bottle-shine {
    left: 12px;
    height: 54px;
  }

  .bottle-name {
    font-size: 0.76rem;
  }

  .bottle-values {
    font-size: 0.62rem;
  }
}
