:root {
  color-scheme: light;
  --bg: #f5efe3;
  --panel: rgba(255, 252, 245, 0.92);
  --panel-strong: #fffaf0;
  --line: rgba(111, 84, 37, 0.16);
  --text: #2f2417;
  --muted: #6f624d;
  --accent: #bb5a2a;
  --accent-deep: #8d3f19;
  --accent-soft: #f4d4b7;
  --shadow: 0 18px 45px rgba(108, 78, 37, 0.14);
  --radius: 22px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 32%),
    linear-gradient(160deg, #f6edd7 0%, #f1e4c7 48%, #e7d2ad 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.32), transparent 90%);
}

.app {
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 36px 0 48px;
}

body.reading-focus .hero,
body.reading-focus .panel > .panel-header,
body.reading-focus .panel > .field,
body.reading-focus .panel > .controls,
body.reading-focus .history-panel {
  filter: blur(10px);
  opacity: 0.24;
  pointer-events: none;
  user-select: none;
  transition: filter 0.25s ease, opacity 0.25s ease;
}

body.reading-focus .action-row {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 20;
  width: min(720px, calc(100vw - 24px));
  padding: 20px;
  border: 1px solid rgba(111, 84, 37, 0.14);
  border-radius: 26px;
  background: rgba(255, 250, 242, 0.92);
  box-shadow: 0 18px 50px rgba(111, 84, 37, 0.22);
  backdrop-filter: blur(20px);
  transform: translateX(-50%);
}

body.reading-focus .panel {
  background: rgba(255, 252, 245, 0.82);
}

.hero {
  display: grid;
  grid-template-columns: 1.6fr 0.9fr;
  gap: 20px;
  align-items: stretch;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-deep);
  font-size: 0.95rem;
  letter-spacing: 0.16em;
}

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

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

.subtitle {
  max-width: 46rem;
  font-size: 1.02rem;
  line-height: 1.8;
  color: var(--muted);
}

.panel,
.status-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.status-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background:
    linear-gradient(155deg, rgba(255, 248, 240, 0.96), rgba(243, 225, 198, 0.95));
}

.status-label,
.status-hint,
#historyHint,
.history-time {
  color: var(--muted);
}

.status-label {
  margin-bottom: 12px;
  font-size: 0.92rem;
}

.status-value {
  margin-bottom: 8px;
  font-size: 1.7rem;
  font-weight: 700;
}

.panel {
  padding: 24px;
  margin-bottom: 22px;
}

.history-panel {
  padding: 0;
}

.history-panel-summary {
  padding: 24px;
  cursor: pointer;
  list-style: none;
}

.history-panel-summary::-webkit-details-marker {
  display: none;
}

.history-panel-body {
  padding: 0 24px 24px;
}

.history-panel-toggle {
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 600;
}

.panel-header,
.history-card-header,
.action-row,
.controls {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 18px;
}

.field span {
  font-weight: 600;
}

.compact {
  flex: 1;
  margin-bottom: 0;
}

textarea,
input[type="range"] {
  width: 100%;
}

select {
  width: 100%;
}

textarea {
  border: 1px solid rgba(111, 84, 37, 0.2);
  border-radius: 18px;
  padding: 16px;
  resize: vertical;
  font: inherit;
  color: var(--text);
  background: var(--panel-strong);
  line-height: 1.7;
}

.voice-select {
  border: 1px solid rgba(111, 84, 37, 0.2);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: var(--panel-strong);
}

textarea:focus,
button:focus,
input:focus {
  outline: 3px solid rgba(187, 90, 42, 0.18);
  outline-offset: 2px;
}

input[type="range"] {
  accent-color: var(--accent);
}

button {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.18s ease, opacity 0.18s ease, background 0.18s ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.primary-button {
  background: linear-gradient(135deg, var(--accent), #d47439);
  color: #fff;
}

.secondary-button,
.ghost-button {
  background: rgba(255, 250, 240, 0.86);
  color: var(--text);
  border: 1px solid rgba(111, 84, 37, 0.15);
}

.small-button {
  padding: 9px 14px;
  font-size: 0.92rem;
}

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

.history-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.history-card {
  border: 1px solid rgba(111, 84, 37, 0.14);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.85);
  padding: 18px;
}

.history-date {
  margin-bottom: 4px;
  font-weight: 700;
}

.history-words {
  margin: 14px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.history-word-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(111, 84, 37, 0.14);
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.95);
  line-height: 1.4;
}

@media (max-width: 840px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .controls,
  .action-row,
  .panel-header,
  .history-card-header,
  .history-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .app {
    width: min(100vw - 20px, 100%);
    padding-top: 18px;
  }

  .panel,
  .status-card {
    padding: 18px;
  }

  .history-panel {
    padding: 0;
  }

  .history-panel-summary,
  .history-panel-body {
    padding-left: 18px;
    padding-right: 18px;
  }

  .history-panel-body {
    padding-bottom: 18px;
  }

  body.reading-focus .action-row {
    left: 10px;
    right: 10px;
    bottom: 14px;
    width: auto;
    transform: none;
  }
}
