:root {
  color-scheme: light;
  --bg: #f4f7f2;
  --ink: #17211d;
  --muted: #5e6863;
  --panel: #ffffff;
  --line: #cfd8cf;
  --accent: #0f766e;
  --accent-dark: #115e59;
  --accent-soft: #d8f3ed;
  --warm: #c2410c;
  --shadow: 0 22px 70px rgba(23, 33, 29, 0.13);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(15, 118, 110, 0.12), transparent 34%),
    linear-gradient(315deg, rgba(194, 65, 12, 0.12), transparent 38%),
    var(--bg);
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 42px 0;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.15rem, 4vw, 4.6rem);
  line-height: 0.95;
}

.intro {
  max-width: 620px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.hero-stat {
  min-width: 174px;
  padding: 18px 20px;
  border: 1px solid rgba(15, 118, 110, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 35px rgba(15, 118, 110, 0.12);
  text-align: right;
}

.hero-stat span:first-child {
  display: block;
  color: var(--accent-dark);
  font-size: 2.1rem;
  font-weight: 850;
  line-height: 1;
}

.hero-stat span:last-child {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: stretch;
}

.editor-panel,
.stats-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.editor-panel {
  display: flex;
  min-height: 560px;
  overflow: hidden;
  flex-direction: column;
}

.panel-header,
.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.panel-header {
  border-bottom: 1px solid var(--line);
}

.panel-header label {
  font-weight: 800;
}

#inputStatus {
  color: var(--muted);
  font-size: 0.92rem;
}

textarea {
  width: 100%;
  min-height: 390px;
  flex: 1;
  padding: 20px 22px;
  border: 0;
  border-radius: 0;
  outline: none;
  resize: vertical;
  background: #fbfefd;
  color: var(--ink);
  font-size: 1.04rem;
  line-height: 1.65;
}

textarea::placeholder {
  color: #7b8680;
}

textarea:focus {
  box-shadow: inset 0 0 0 3px rgba(15, 118, 110, 0.18);
}

.editor-footer {
  border-top: 1px solid var(--line);
  background: rgba(238, 244, 237, 0.78);
}

.editor-footer p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

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

.button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.28);
  outline-offset: 2px;
}

.button.primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 10px 20px rgba(15, 118, 110, 0.24);
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.secondary {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.button.secondary:hover {
  background: #eef4ed;
}

.stats-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px;
}

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

.stat-card,
.reading-card {
  border: 1px solid rgba(218, 207, 191, 0.9);
  border-radius: 8px;
  background: #ffffff;
}

.stat-card {
  min-height: 112px;
  padding: 14px;
}

.stat-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.stat-card strong,
.reading-card strong {
  display: block;
  margin-top: 14px;
  color: var(--ink);
  font-size: 2rem;
  line-height: 1;
}

.reading-card {
  padding: 16px;
  background:
    linear-gradient(135deg, var(--accent-soft), #ffffff 68%),
    linear-gradient(315deg, rgba(194, 65, 12, 0.12), transparent 46%);
}

.reading-card strong {
  color: var(--accent-dark);
  font-size: 2.2rem;
}

#readingTimeDetail {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-size: 0.92rem;
}

.copy-status {
  min-height: 22px;
  margin: 0;
  color: var(--accent-dark);
  font-size: 0.92rem;
  font-weight: 700;
}

@media (max-width: 900px) {
  .shell {
    width: min(100% - 24px, 720px);
    padding: 28px 0;
  }

  .hero,
  .workspace {
    display: block;
  }

  .hero-stat {
    margin-top: 18px;
    text-align: left;
  }

  .stats-panel {
    margin-top: 16px;
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 18px, 520px);
    padding: 22px 0;
  }

  .editor-panel {
    min-height: 470px;
  }

  .panel-header,
  .editor-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .actions {
    width: 100%;
  }

  .button {
    flex: 1 1 130px;
  }

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

  textarea {
    min-height: 300px;
    padding: 16px;
    font-size: 1rem;
  }
}
