/* Mobile App Shell & Bottom Tab Navigation */
:root {
  --tab-bar-height: 62px;
  --header-height: 54px;
}

body.app-mode {
  padding-bottom: calc(var(--tab-bar-height) + env(safe-area-inset-bottom, 12px));
}

/* App Header - Clean, Single-Line, No Wrap */
.app-header {
  position: sticky;
  top: 0;
  height: var(--header-height);
  background: rgba(250, 247, 242, 0.95);
  border-bottom: 1px solid var(--border-subtle);
  padding: 0 1rem;
  z-index: 950;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

[data-theme="dark"] .app-header {
  background: rgba(19, 26, 34, 0.95);
}

[data-theme="sepia"] .app-header {
  background: rgba(244, 236, 216, 0.95);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1;
}

.header-title-clean {
  font-family: var(--font-serif-title);
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

[data-theme="dark"] .header-title-clean {
  color: #FFFFFF;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* Streak Counter Chip */
.streak-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--color-gold-bg);
  border: 1px solid var(--border-gold);
  color: var(--color-terracotta-dark);
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-full);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--transition-normal);
}

.streak-chip:hover {
  transform: scale(1.04);
}

.icon-btn-ghost {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--text-main);
  background: transparent;
  cursor: pointer;
  transition: background var(--transition-normal);
}

.icon-btn-ghost:hover {
  background: var(--bg-accent-soft);
}

/* Bottom App Navigation Bar */
.app-tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--tab-bar-height);
  background: rgba(255, 255, 255, 0.97);
  border-top: 1px solid var(--border-light);
  display: flex;
  justify-content: space-around;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 -3px 18px rgba(0, 0, 0, 0.04);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

[data-theme="sepia"] .app-tab-bar {
  background: rgba(239, 228, 204, 0.97);
}

[data-theme="dark"] .app-tab-bar {
  background: rgba(26, 35, 46, 0.97);
  border-top-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3);
}

.tab-item {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-normal);
  padding: 4px 0;
  min-width: 44px;
}

.tab-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  transition: transform var(--transition-normal);
}

.tab-item:hover {
  color: var(--color-terracotta);
}

.tab-item.active {
  color: var(--color-terracotta);
  font-weight: 700;
}

.tab-item.active svg {
  transform: translateY(-2px);
  stroke-width: 2.2;
}

/* App View Containers */
.app-view {
  display: none;
  opacity: 0;
  animation: viewFadeIn 0.2s ease forwards;
}

.app-view.active {
  display: block;
}

@keyframes viewFadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}
