:root {
  --bg: #f4efe4;
  --panel: rgba(255, 251, 244, 0.92);
  --ink: #1f2226;
  --muted: #5d625d;
  --line: rgba(47, 50, 46, 0.14);
  --accent: #d56d2b;
  --accent-strong: #9d4313;
  --teal: #0f7a73;
  --danger: #b53a2c;
  --shadow: 0 24px 80px rgba(63, 41, 17, 0.14);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(213, 109, 43, 0.12), transparent 28%),
    radial-gradient(circle at top right, rgba(15, 122, 115, 0.12), transparent 24%),
    linear-gradient(180deg, #f6f0e5 0%, #efe6d5 100%);
  font-family: "Manrope", sans-serif;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.page-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(71, 55, 31, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(71, 55, 31, 0.04) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.85), transparent 90%);
}

#app {
  position: relative;
  min-height: 100vh;
  padding: 28px;
}

.shell {
  max-width: 1480px;
  margin: 0 auto;
}

.hero,
.editor-shell {
  position: relative;
  z-index: 1;
}

.hero {
  padding: 40px;
  border: 1px solid rgba(72, 59, 36, 0.08);
  border-radius: 36px;
  background:
    linear-gradient(135deg, rgba(255, 248, 236, 0.96), rgba(255, 255, 255, 0.76)),
    linear-gradient(135deg, rgba(213, 109, 43, 0.08), rgba(15, 122, 115, 0.08));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero::before,
.hero::after,
.editor-shell::before {
  content: "";
  position: absolute;
  border-radius: 999px;
  filter: blur(12px);
  opacity: 0.8;
}

.hero::before {
  width: 260px;
  height: 260px;
  right: -60px;
  top: -80px;
  background: rgba(213, 109, 43, 0.16);
}

.hero::after {
  width: 220px;
  height: 220px;
  left: -70px;
  bottom: -90px;
  background: rgba(15, 122, 115, 0.12);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 28px;
  align-items: start;
}

.eyebrow,
.chip,
.mono,
.status-pill,
.meta-label {
  font-family: "IBM Plex Mono", monospace;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(31, 34, 38, 0.05);
  color: var(--muted);
  font-size: 0.82rem;
}

.hero h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(2.4rem, 5vw, 4.8rem);
  line-height: 0.96;
  letter-spacing: -0.04em;
}

.hero-copy {
  max-width: 60ch;
  margin-top: 16px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.hero-panel,
.panel {
  border: 1px solid rgba(31, 34, 38, 0.08);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 36px rgba(73, 48, 18, 0.08);
}

.hero-panel {
  padding: 24px;
}

.section-title {
  margin: 0 0 18px;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.field-group {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field-group label {
  color: var(--muted);
  font-size: 0.92rem;
}

.input,
.textarea,
.search-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid rgba(31, 34, 38, 0.12);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.textarea {
  min-height: 170px;
  resize: vertical;
  line-height: 1.6;
}

.input:focus,
.textarea:focus,
.search-input:focus {
  outline: none;
  border-color: rgba(213, 109, 43, 0.65);
  box-shadow: 0 0 0 4px rgba(213, 109, 43, 0.12);
}

.muted {
  color: var(--muted);
}

.button-row,
.toolbar-actions,
.toolbar-meta,
.filter-row,
.status-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 34, 38, 0.08);
  color: var(--ink);
  font-weight: 700;
  transition: transform 120ms ease, background 120ms ease, opacity 120ms ease;
}

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

.button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

.button-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: white;
}

.button-ghost {
  background: rgba(31, 34, 38, 0.04);
}

.button-danger {
  background: rgba(181, 58, 44, 0.1);
  color: var(--danger);
}

.drop-zone {
  display: grid;
  place-items: center;
  gap: 12px;
  min-height: 220px;
  padding: 26px;
  border: 2px dashed rgba(31, 34, 38, 0.14);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 248, 236, 0.9));
  text-align: center;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.drop-zone.is-active {
  transform: translateY(-2px);
  border-color: rgba(213, 109, 43, 0.62);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 239, 225, 0.96));
}

.drop-zone strong {
  display: block;
  font-size: 1.1rem;
}

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

.stat-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 1.5rem;
  letter-spacing: -0.04em;
}

.recent-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
}

.recent-item strong {
  display: block;
}

.recent-item small {
  color: var(--muted);
}

.editor-shell {
  overflow: hidden;
  border: 1px solid rgba(31, 34, 38, 0.08);
  border-radius: 34px;
  background:
    linear-gradient(180deg, rgba(255, 251, 244, 0.94), rgba(255, 255, 255, 0.9));
  box-shadow: var(--shadow);
}

.editor-shell::before {
  width: 260px;
  height: 260px;
  right: -80px;
  bottom: -100px;
  background: rgba(15, 122, 115, 0.08);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 252, 247, 0.82);
}

.toolbar h1 {
  margin: 0 0 4px;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
  letter-spacing: -0.04em;
}

.toolbar p {
  margin: 0;
  color: var(--muted);
}

.chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(31, 34, 38, 0.06);
  color: var(--muted);
  font-size: 0.8rem;
}

.status-pill.is-editing {
  background: rgba(15, 122, 115, 0.12);
  color: var(--teal);
}

.status-pill.is-readonly {
  background: rgba(181, 58, 44, 0.1);
  color: var(--danger);
}

.editor-grid {
  display: grid;
  grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
  gap: 0;
  min-height: calc(100vh - 180px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(244, 239, 228, 0.9), rgba(255, 250, 242, 0.76));
}

.sidebar-top,
.detail-head,
.detail-grid,
.sidebar-list {
  padding: 20px;
}

.sidebar-top {
  display: grid;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.filter-row {
  gap: 8px;
}

.filter-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(31, 34, 38, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.68);
  color: var(--muted);
  font-weight: 600;
}

.filter-button.is-active {
  background: rgba(213, 109, 43, 0.12);
  color: var(--accent-strong);
  border-color: rgba(213, 109, 43, 0.22);
}

.sidebar-list {
  display: grid;
  gap: 10px;
  max-height: calc(100vh - 330px);
  overflow: auto;
}

.entry-item {
  display: grid;
  gap: 8px;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.66);
  text-align: left;
}

.entry-item:hover {
  border-color: rgba(31, 34, 38, 0.1);
}

.entry-item.is-selected {
  border-color: rgba(213, 109, 43, 0.22);
  background: rgba(255, 239, 225, 0.92);
}

.entry-item.is-fuzzy {
  box-shadow: inset 3px 0 0 rgba(213, 109, 43, 0.88);
}

.entry-item.is-translated {
  box-shadow: inset 3px 0 0 rgba(15, 122, 115, 0.88);
}

.entry-item.is-untranslated {
  box-shadow: inset 3px 0 0 rgba(31, 34, 38, 0.16);
}

.entry-item strong {
  font-size: 0.95rem;
  line-height: 1.4;
}

.entry-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.78rem;
}

.detail {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-head h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
}

.detail-grid {
  display: grid;
  gap: 18px;
}

.detail-card {
  padding: 18px;
  border: 1px solid rgba(31, 34, 38, 0.08);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.74);
}

.detail-card h3 {
  margin: 0 0 12px;
  font-size: 0.98rem;
}

.source-copy {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
}

.translation-group {
  display: grid;
  gap: 14px;
}

.translation-group label,
.meta-list strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.meta-list {
  display: grid;
  gap: 12px;
}

.meta-block {
  padding: 14px;
  border-radius: var(--radius-md);
  background: rgba(244, 239, 228, 0.68);
}

.status-banner {
  margin: 0 20px 20px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: rgba(31, 34, 38, 0.05);
  color: var(--muted);
}

.status-banner.is-warning {
  background: rgba(181, 58, 44, 0.1);
  color: var(--danger);
}

.status-banner.is-info,
.status-banner.is-success {
  background: rgba(15, 122, 115, 0.1);
  color: var(--teal);
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 100%;
  padding: 48px 20px;
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 10px;
  font-size: 1.1rem;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1040px) {
  #app {
    padding: 18px;
  }

  .hero,
  .editor-shell {
    border-radius: 24px;
  }

  .hero-grid,
  .editor-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-list {
    max-height: none;
  }

  .toolbar,
  .detail-head {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .hero,
  .hero-panel,
  .toolbar,
  .sidebar-top,
  .sidebar-list,
  .detail-head,
  .detail-grid,
  .status-banner {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .button,
  .filter-button {
    width: 100%;
  }
}
