* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100dvh;
  font-family: "Trebuchet MS", "Segoe UI", Arial, sans-serif;
  background: #111116;
  color: #f3ece4;
  position: relative;
}

input,
textarea,
select,
button {
  font-size: 16px;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 18%, rgba(244, 214, 167, 0.1), transparent 26%),
    radial-gradient(circle at 88% 10%, rgba(172, 153, 114, 0.12), transparent 24%),
    radial-gradient(circle at 50% 100%, rgba(126, 116, 98, 0.12), transparent 30%),
    #111116;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat;
  background-size: cover, cover, cover, auto;
}

.app {
  max-width: 860px;
  margin: 2rem auto;
  padding: 0 1rem 2rem;
}

.header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 0.5rem;
}

.header-copy {
  min-width: 0;
}

.logo-link {
  display: inline-flex;
  flex: 0 0 auto;
  border-radius: 16px;
}

.logo-link:focus-visible {
  outline: 2px solid #f2d18f;
  outline-offset: 3px;
}

.header-logo {
  width: 80px;
  height: 80px;
  object-fit: contain;
  border-radius: 16px;
}

.header h1 {
  margin: 0;
  font-size: 1.95rem;
  letter-spacing: 0.02em;
  color: #f9e7ca;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
}

.header p {
  margin: 0.5rem 0 1.5rem;
  color: #d3c7bb;
}

.welcome-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.continue-card p {
  color: #d3c7bb;
  line-height: 1.45;
  margin: 0.5rem 0 0;
}

.continue-btn {
  min-height: 170px;
}

.session-progress {
  width: 100%;
  max-width: 260px;
  height: 0.55rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(38, 27, 16, 0.28);
  margin-top: 0.7rem;
}

.session-progress-fill {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: #261b10;
}

.app-version {
  margin-top: 0.35rem;
  color: #9f95a8;
  font-size: 0.78rem;
  text-align: center;
}

.app-version p {
  margin: 0.15rem 0;
}

#app-version-label {
  color: #d3c7bb;
  font-weight: 700;
  letter-spacing: 0.04em;
}

@media (max-width: 640px) {
  .app {
    padding-top: max(0.5rem, env(safe-area-inset-top));
  }

  .header {
    align-items: flex-start;
  }

  .header-logo {
    width: 64px;
    height: 64px;
    border-radius: 14px;
  }

  .welcome-actions {
    grid-template-columns: 1fr;
  }
}

.length-btn {
  width: 100%;
  min-height: 190px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 12px;
  padding: 0.9rem 0.85rem;
  gap: 0.18rem;
  background: linear-gradient(180deg, #d1b07c, #bc9668);
  color: #261b10;
  border: 1px solid #9f7f57;
}

.topic-btn {
  min-height: 210px;
}

.length-icon {
  font-size: 2.7rem;
  line-height: 1;
  margin-bottom: 0.5rem;
  filter: saturate(0.65) brightness(0.9);
}

.length-name {
  font-size: 1.02rem;
  font-weight: 800;
}

.length-meta {
  font-size: 0.9rem;
  color: #4a3520;
}

.card,
.terminal-section,
.feedback,
.quiz-options {
  background: linear-gradient(165deg, #1b1a24, #171720);
  border: 1px solid #3f3a4e;
  border-radius: 18px;
  padding: 1.05rem 1.1rem;
  margin-bottom: 1rem;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.28);
}

.offline-tip {
  margin-top: 1rem;
  padding: 0.8rem 0.9rem;
  border: 1px solid #6a5a36;
  border-radius: 12px;
  background: linear-gradient(165deg, #211d18, #171720);
}

.offline-tip p {
  margin: 0;
  color: #eadcc7;
  line-height: 1.45;
}

.question-meta {
  display: flex;
  justify-content: space-between;
  color: #d7c7b4;
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

h2 {
  margin: 0;
  color: #f7ece1;
}

.endpoint-hint {
  margin-top: 0.8rem;
  padding: 0.62rem 0.78rem;
  border-radius: 12px;
  background: #15131c;
  border: 1px dashed #5a5069;
  color: #e0d7cd;
  font-size: 0.92rem;
}

.endpoint-hint code {
  color: #f2c88e;
}

.terminal-input-wrap {
  display: flex;
  align-items: center;
  background: #0f0e15;
  border: 1px solid #504663;
  border-radius: 14px;
  padding: 0.5rem 0.75rem;
  margin: 0.5rem 0 0.75rem;
}

.prompt {
  color: #f3c17d;
  margin-right: 0.6rem;
  font-weight: 700;
}

#command-input {
  width: 100%;
  border: none;
  outline: none;
  background: transparent;
  color: #f4ede6;
  font-family: Consolas, monospace;
  font-size: 16px;
}

#command-input::placeholder {
  color: #9f95a8;
}

.actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

button {
  border: none;
  border-radius: 999px;
  padding: 0.58rem 1rem;
  cursor: pointer;
  background: linear-gradient(180deg, #f2d18f, #ddb477);
  color: #2a1f12;
  font-weight: 700;
  transition: transform 120ms ease, filter 120ms ease;
}

button.secondary {
  background: linear-gradient(180deg, #3f374f, #332d42);
  color: #f1e6db;
  border: 1px solid #665a79;
}

button.success-next {
  background: linear-gradient(180deg, #7ad89a, #57bc7a);
  color: #0e2b19;
  border: 1px solid #87e3a6;
}

button:hover {
  filter: brightness(1.07);
  transform: translateY(-1px);
}

.feedback {
  min-height: 70px;
}

.more-details-btn {
  display: block;
  margin-top: 0.85rem;
}

.more-details-content {
  margin-top: 0.8rem;
  padding: 0.85rem 0.95rem;
  border: 1px solid #4c765b;
  border-radius: 12px;
  background: rgba(10, 21, 16, 0.55);
  color: #e8f3eb;
  line-height: 1.45;
}

.more-details-content p {
  margin: 0 0 0.7rem;
}

.more-details-content p:last-child {
  margin-bottom: 0;
}

.more-details-content ul {
  margin: 0.35rem 0 0.75rem;
  padding-left: 1.15rem;
}

.more-details-content li {
  margin-bottom: 0.35rem;
}

.feedback.good {
  border-color: #85c49c;
  background: linear-gradient(165deg, #15231d, #131d19);
}

.feedback.bad {
  border-color: #d08fa0;
  background: linear-gradient(165deg, #281820, #1e151b);
}

.hidden {
  display: none;
}

.option-buttons {
  display: flex;
  flex-direction: row;
  gap: 0.7rem;
  align-items: stretch;
  justify-content: center;
  flex-wrap: wrap;
}

.option-btn {
  display: block;
  width: min(100%, 260px);
  padding: 0.95rem 1rem;
  text-align: left;
  background: linear-gradient(180deg, #2d273b, #252032);
  color: #f5ece3;
  font-family: Consolas, monospace;
  line-height: 1.25;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
  border: 1px solid #5c4e70;
  border-radius: 8px;
}

.option-feedback {
  margin-top: 0.75rem;
  color: #e5ddd4;
}

#option-next-btn {
  margin-top: 1.35rem;
}
