:root {
  --bg: #d8d8de;
  --panel: #f5f3ef;
  --ink: #1e2a3b;
  --muted: #5f6774;
  --accent: #d93e3e;
  --nav: #1f2a3c;
  --success: #28a645;
  --danger: #d13b3b;
  --border: #d4d0c9;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, #ececf0, var(--bg));
  min-height: 100vh;
}

.app-shell {
  max-width: 520px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #fcfbf9 0%, #f1eee8 100%);
  border-left: 1px solid #c7c2b8;
  border-right: 1px solid #c7c2b8;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8rem 1rem;
  color: #fff;
  background: linear-gradient(180deg, #3c4860 0%, #1e2737 100%);
}

.brand {
  font-size: 1.05rem;
  font-weight: 700;
}

.status-badge {
  font-size: 0.8rem;
  padding: 0.2rem 0.45rem;
  border-radius: 999px;
  background: #e9a33d;
  color: #222;
}

.app-main {
  flex: 1;
  padding: 1rem 1rem 5.2rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

h1, h2 {
  margin-top: 0;
}

.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0.9rem;
  background: #f8f6f2;
  box-shadow: 0 2px 0 #e4e0d8;
}

.pack-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.pack-btn {
  padding: 0.6rem;
  border-radius: 8px;
  border: 1px solid #b8bcc4;
  background: linear-gradient(180deg, #ffffff, #eceff5);
  color: #283347;
  font-weight: 700;
  cursor: pointer;
}

.pack-btn.selected {
  border-color: #d04949;
  background: linear-gradient(180deg, #ffe4e4, #ffd1d1);
}

.step-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  gap: 0.7rem;
}

.step-row input {
  width: 90px;
  border: 1px solid #bfc3ca;
  border-radius: 8px;
  padding: 0.35rem 0.45rem;
  font-size: 1rem;
  text-align: center;
}

.btn {
  width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 0.7rem 0.9rem;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-lg {
  font-size: 1.2rem;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #f25a5a, #c73333);
}

.btn-success {
  color: #fff;
  background: linear-gradient(180deg, #3bc158, #24963f);
}

.btn-danger {
  color: #fff;
  background: linear-gradient(180deg, #ec5959, #c92f2f);
}

.btn-neutral {
  color: #243246;
  background: linear-gradient(180deg, #ffffff, #e6e9ef);
  border: 1px solid #c3c8d1;
}

.btn-ghost {
  width: auto;
  padding: 0.45rem 0.7rem;
  font-size: 0.9rem;
  color: #233248;
  background: #fff;
  border: 1px solid #ccd1db;
}

.session-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
}

.word-card {
  min-height: 240px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.word-value {
  font-size: clamp(2rem, 8vw, 3.3rem);
  font-weight: 700;
  margin-bottom: 1.1rem;
}

.translation {
  display: inline-block;
  background: #ffe7a5;
  color: #283043;
  border: 1px solid #dcc67e;
  border-radius: 8px;
  padding: 0.4rem 0.85rem;
  margin-bottom: 1rem;
  font-weight: 700;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 0.35rem 0 0;
}

.session-actions {
  display: grid;
  gap: 0.6rem;
}

.stats-list {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.55rem 0.8rem;
  margin: 0;
}

.stats-list dt {
  font-weight: 700;
  color: #2e3a4f;
}

.stats-list dd {
  margin: 0;
}

.row-buttons {
  display: grid;
  gap: 0.6rem;
}

.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(520px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid #0f1621;
  background: linear-gradient(180deg, #303b4f, #1b2535);
}

.nav-btn {
  border: 0;
  color: #f4f5f9;
  background: transparent;
  padding: 0.85rem 0.25rem;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
}

.nav-btn.active {
  background: linear-gradient(180deg, #f95c5c, #ce3434);
}

@media (min-width: 900px) {
  .app-shell {
    margin: 1.4rem auto;
    border-radius: 18px;
    border: 1px solid #bcc2cc;
    min-height: calc(100vh - 2.8rem);
    overflow: hidden;
  }

  .bottom-nav {
    border-radius: 0 0 18px 18px;
  }
}
