/* Single-screen 16:9 Widescreen Layout (1440x900 & 1280x720 zero-overflow) */

.app-shell {
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

/* Subtle Xuan paper atmospheric noise overlay on edges */
.app-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 55%, rgba(8, 6, 4, 0.65) 100%),
    repeating-linear-gradient(
      90deg,
      rgba(255, 240, 210, 0.012) 0px,
      rgba(255, 240, 210, 0.012) 1px,
      transparent 1px,
      transparent 6px
    );
  z-index: 0;
}

/* Top Bar */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  gap: 12px;
  background: linear-gradient(180deg, #211c16 0%, #171310 100%);
  border-bottom: 1px solid var(--ink-border);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.brand-seal {
  width: 34px;
  height: 34px;
  border-radius: 6px;
  background: linear-gradient(145deg, #df4b3f, #a92820);
  border: 1.5px solid #f4a48f;
  color: #fff5e6;
  font-family: var(--font-serif);
  font-weight: 900;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px rgba(217, 65, 54, 0.42), inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.brand-title {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-title h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.14em;
  color: var(--paper-bright);
}

.brand-title small {
  font-size: 10.5px;
  color: var(--gold-foil);
  letter-spacing: 0.1em;
  opacity: 0.88;
}

/* Navigation Mode Tabs */
.mode-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(14, 12, 10, 0.65);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid var(--ink-border);
}

.mode-tab {
  border: 1px solid transparent;
  background: transparent;
  color: var(--paper-muted);
  font-family: var(--font-serif);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  border-radius: 7px;
  cursor: pointer;
  transition: all 0.18s ease;
  white-space: nowrap;
}

.mode-tab:hover {
  color: var(--paper-bright);
  background: rgba(230, 184, 92, 0.08);
}

.mode-tab.active {
  color: #1b140c;
  background: linear-gradient(180deg, #f3ce7e 0%, #cf9a42 100%);
  border-color: #ffe8a8;
  box-shadow: 0 2px 10px rgba(230, 184, 92, 0.3);
}

.topbar-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Main View Container */
.workspace {
  flex: 1;
  min-height: 0;
  position: relative;
  z-index: 5;
  display: flex;
}

.view-panel {
  display: none;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.view-panel.active {
  display: flex;
}

/* Puzzle & Workshop 2-Column Stage */
.stage-layout {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.stage-center {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 10px 14px 12px 16px;
  gap: 8px;
  position: relative;
}

.stage-hud-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 10px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: rgba(28, 23, 18, 0.88);
  border: 1px solid var(--ink-border);
}

.stage-canvas-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
  border-radius: var(--radius-lg);
  background: #14110e;
  border: 1px solid var(--ink-border);
  box-shadow: inset 0 0 36px rgba(0, 0, 0, 0.72), 0 8px 28px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stage-canvas-wrap canvas {
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.stage-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: rgba(24, 20, 16, 0.9);
  border: 1px solid var(--ink-border-subtle);
  font-size: 13px;
}

/* Right Scroll Sidebar */
.scroll-sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 14px 12px 8px;
  background: linear-gradient(180deg, rgba(29, 24, 19, 0.96) 0%, rgba(20, 17, 13, 0.98) 100%);
  border-left: 1px solid var(--ink-border);
  overflow-y: auto;
}

/* Roguelike Layout */
.rogue-layout {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
}

.rogue-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 12px 14px 12px 16px;
  gap: 10px;
}

.rogue-arena {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 20px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 50% 28%, rgba(217, 65, 54, 0.12) 0%, transparent 55%),
    radial-gradient(circle at 50% 80%, rgba(230, 184, 92, 0.08) 0%, transparent 50%),
    #15120f;
  border: 1px solid var(--ink-border);
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.72);
  position: relative;
  overflow: hidden;
}

.rogue-hand-dock {
  min-height: 134px;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, #231d17 0%, #191511 100%);
  border: 1px solid var(--ink-border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Codex Layout */
.codex-layout {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: 12px 18px;
  gap: 12px;
  min-height: 0;
}

/* Workshop Layout */
.workshop-palette {
  width: 290px;
  min-width: 290px;
  height: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 10px 12px;
  background: linear-gradient(180deg, #211c16 0%, #171310 100%);
  border-right: 1px solid var(--ink-border);
  overflow-y: auto;
}

/* Compact responsiveness for 1280x720 laptops */
@media (max-width: 1320px), (max-height: 760px) {
  :root {
    --topbar-h: 48px;
    --sidebar-w: 292px;
  }
  .brand-title h1 { font-size: 16px; }
  .mode-tab { padding: 5px 11px; font-size: 13px; }
  .stage-center { padding: 8px 10px 10px 12px; gap: 6px; }
  .scroll-sidebar { padding: 8px 10px 10px 8px; gap: 8px; }
  .rogue-hand-dock { min-height: 118px; padding: 8px 12px; }
}
