/* --- App layout --- */
#app {
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg-base);
}

/* --- Header --- */
.header {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 14px 16px 10px;
  padding-top: calc(env(safe-area-inset-top, 14px) + 10px);
  flex-shrink: 0;
}

.wordmark {
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.wordmark-watch {
  color: var(--text-primary);
}

.wordmark-tower {
  color: var(--accent);
}

/* --- Screens --- */
.screen {
  display: none;
  flex: 1;
  overflow-y: auto;
  padding: 0 16px 24px;
  -webkit-overflow-scrolling: touch;
}

.screen.active {
  display: block;
}

.screen-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 60%;
  color: var(--text-muted);
  font-family: 'DM Mono', monospace;
  font-size: 13px;
}

/* --- Bottom nav --- */
.bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-around;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-top: 0.5px solid var(--border);
  padding: 4px 0 4px;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  flex: 1;
  padding: 0;
  position: relative;
  transition: color 0.15s;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.15s;
}

.nav-item span {
  font-family: 'DM Mono', monospace;
  font-size: 10px;
  color: var(--text-muted);
  transition: color 0.15s;
}

.nav-item.active svg {
  stroke: var(--accent);
}

.nav-item.active span {
  color: var(--accent);
}

/* --- Login (session cookie) --- */
.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 24px 24px env(safe-area-inset-bottom, 24px);
  padding-top: calc(env(safe-area-inset-top, 0) + 24px);
}

.login-screen.hidden {
  display: none;
}

.login-wordmark {
  font-family: 'DM Mono', monospace;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.login-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.login-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-label {
  font-family: 'DM Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.login-input {
  width: 100%;
  box-sizing: border-box;
  padding: 14px 16px;
  border-radius: 12px;
  background: var(--bg-raised);
  border: 0.5px solid var(--border-subtle);
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  color: var(--text-primary);
}

.login-input:focus {
  outline: none;
  border-color: var(--accent);
}

.login-submit {
  margin-top: 4px;
  padding: 14px 24px;
  border-radius: 12px;
  background: var(--accent);
  color: #fff;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
  border: none;
  cursor: pointer;
}

.login-submit:active {
  opacity: 0.9;
}

.login-error {
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  color: var(--reading-red);
  text-align: center;
}

.login-error.hidden {
  display: none;
}