/* ===== layout.css — 5DO Design System ===== */

#appShell, #app {
  width: 100%; max-width: 520px;
  margin: 0 auto; min-height: 100vh;
  padding: 0 0 24px;
  position: relative; z-index: 2;
  /* Not a token: --uiOpacity is a live user setting, so the alpha is a
     variable and the channels have to be written out. */
  background: rgba(6, 10, 18, var(--uiOpacity, 0.94));
  transition: background .25s ease;
}

/* Header */
header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  max-width: 520px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: var(--panel-blur) !important;
  backdrop-filter: blur(28px) saturate(1.4); -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border-bottom: 1px solid var(--glass-border) !important;
}
.left-pack { display: flex; align-items: center; gap: 10px; }
.app-title {
  color: var(--primary); text-shadow: var(--title-glow);
  font-weight: 800; font-size: var(--t-title); letter-spacing: .5px;
}
.right-pack { display: flex; align-items: center; gap: 10px; }
#langBtn {
  padding: 5px 12px; border: 1px solid var(--tint); border-radius: var(--r-lg);
  background: var(--glass); color: var(--text-primary);
  font-size: var(--t-micro); font-weight: 600; cursor: pointer; transition: all var(--transition);
}
#langBtn:hover { background: var(--surface); border-color: var(--tint-strong); }

/* Tab bar */
.tab-bar {
  display: flex;
  background: var(--panel-blur);
  backdrop-filter: blur(24px) saturate(1.3); -webkit-backdrop-filter: blur(24px) saturate(1.3);
  /* BOTTOM, not top. See the comment on <nav class="tab-bar"> in 5do.html.
     padding-bottom carries the iPhone home-indicator inset so the labels are
     never under it. */
  border-top: 1px solid var(--glass-border);
  padding: 0 4px; padding-bottom: var(--safe-b); gap: 0;
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 19;
  max-width: 520px; margin: 0 auto;
}
.tab {
  flex: 1; padding: 7px 2px 5px;
  border: none; border-radius: 0;
  background: transparent; color: var(--text-tertiary);
  cursor: pointer;
  transition: color var(--transition); white-space: nowrap;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-width: 0; min-height: var(--h-tabbar);
}
/* The label is the point: six unlabelled glyphs had to be decoded on first run. */
.tab-label { font-size: var(--t-micro); font-weight: 500; line-height: 1; letter-spacing: -.2px; }
.tab svg {
  width: 22px; height: 22px;
  stroke: currentColor;
  transition: transform .2s ease, filter .2s ease;
}
.tab.active svg {
  /* This glow was PURPLE — rgba(124,92,252,.55), the accent of an abandoned
     theme — burning under a cyan icon in a blue app. Nobody would have chosen
     it; it was simply never cleaned up. The active tab is already marked by a
     cyan stroke and a cyan underline, so the glow has no work to do. */
  filter: none;
}
.tab:active svg { transform: scale(.9); }
.tab.active {
  color: var(--primary);
  background: transparent !important;
}
.tab:hover:not(.active) { color: var(--text-secondary); }

/* Icon button */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--glass); color: var(--text-primary); cursor: pointer; padding: 0;
  transition: all var(--transition);
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover { background: var(--tint-weak); border-color: var(--border-hover); }
.icon-btn:active { transform: scale(.95); }

/* Hamburger */
.hamburger { width: 20px; height: 20px; position: relative; cursor: pointer; }
.hamburger span, .hamburger span:before, .hamburger span:after {
  position: absolute; left: 0; right: 0; height: 2px; background: var(--primary); content: "";
  box-shadow: 0 0 8px var(--primary-glow);
  border-radius: var(--r-pill);
}
.hamburger span { top: 9px; }
.hamburger span:before { top: -6px; }
.hamburger span:after { top: 6px; }
.dropdown {
  position: absolute; top: 46px; left: 0;
  background: var(--panel-blur) !important;
  backdrop-filter: blur(28px) saturate(1.3); -webkit-backdrop-filter: blur(28px) saturate(1.3);
  border: 1px solid var(--border) !important;
  min-width: 220px; border-radius: var(--r-lg);
  box-shadow: 0 20px 60px var(--scrim), 0 0 1px var(--tint); display: none; overflow: hidden;
}
.dropdown a {
  display: block; padding: 14px 18px; border-bottom: 1px solid var(--wash-weak);
  color: var(--text-secondary); font-size: var(--t-body);
  transition: all var(--transition);
}
.dropdown a:last-child { border-bottom: 0; }
.dropdown a:hover { background: var(--tint-weak) !important; color: var(--text-primary); }
.menu-container { position: relative; }
/* padding-bottom clears the fixed bottom tab bar; without it the last row of
   every list sits underneath it and cannot be tapped. */
main { padding: 12px 16px; padding-top: var(--chrome-top); padding-bottom: calc(var(--chrome-bottom) + 12px); }

/* Backdrop */
#backdropLayer, #backdropDim { position: fixed; inset: 0; z-index: 0; pointer-events: none; }
#backdropLayer { background-size: cover; background-position: center; will-change: opacity; transition: opacity .3s ease; }
#backdropDim { background: var(--scrim-weak); z-index: 1; transition: opacity .25s ease; }
#backdrop { position: fixed; inset: 0; z-index: 9998 !important; }
#modal { position: fixed; z-index: 9999 !important; }
