/* Page structure, responsive navigation and accessibility. */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; scroll-padding-top: 96px; }
body { margin: 0; min-width: 280px; background: var(--color-bg-canvas); color: var(--color-text-primary); font-family: var(--font-family-base); font-size: var(--font-size-base); line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; }
button, select { touch-action: manipulation; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
button, input, select, textarea { max-width: 100%; }
a { color: var(--color-brand-primary); }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--color-focus-ring); outline-offset: 3px; }
::selection { background: #d8e6db; color: var(--color-text-primary); }
.sr-only, .visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-links { position: absolute; z-index: 100; inset: 0 auto auto 0; }
.skip-link { position: fixed; top: -100px; left: 16px; padding: 12px 16px; background: var(--color-brand-primary); color: #fff; border-radius: 8px; text-decoration: none; }
.skip-link:focus { top: 12px; }
.icon { display: inline-block; flex: 0 0 auto; width: 20px; height: 20px; vertical-align: middle; object-fit: contain; }
.app-header { position: sticky; top: 0; z-index: var(--z-header); min-height: var(--header-height); display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 12px max(32px, calc((100vw - 1376px) / 2)); background: var(--color-bg-surface); border-bottom: 1px solid var(--color-border-subtle); }
.header-left, .header-right { display: flex; align-items: center; gap: 16px; min-width: 0; }
.header-right { gap: 12px; flex-shrink: 0; }
.brand-logo { display: inline-flex; align-items: center; gap: 10px; color: var(--color-text-primary); font-size: 19px; font-weight: 650; letter-spacing: -.6px; text-decoration: none; white-space: nowrap; }
.brand-emblem { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 8px; background: var(--color-brand-primary-light); }
.brand-emblem .icon { width: 22px; height: 22px; }
.brand-text-accent { color: var(--color-brand-primary); }
.workspace-label { color: var(--color-text-muted); font-size: 11px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase; }
.brand-lockup { display: grid; gap: 1px; }
.brand-tagline { color: var(--color-text-muted); font-size: 10px; font-weight: 400; letter-spacing: 0; line-height: 1.4; }
.brand-mark { width: 38px; height: 38px; background: var(--color-brand-primary); }
.brand-mark .icon { filter: brightness(0) invert(1); }
.header-active-channel { display: flex; align-items: center; gap: 8px; color: var(--color-text-muted); font-size: 13px; }
.active-channel-separator { color: var(--color-border-strong); }
.mobile-menu-toggle, .mobile-menu-btn { display: none; }
.app-layout, .app-container { display: grid; grid-template-columns: var(--sidebar-width) minmax(480px, 1fr) var(--guide-sidebar-width); align-items: start; gap: 32px; max-width: 1440px; margin: 0 auto; padding: 32px; }
.sidebar, .app-sidebar, .guide-sidebar, .survival-guide-sidebar { position: sticky; top: calc(var(--header-height) + 32px); min-width: 0; }
.sidebar-inner, .guide-sidebar-inner { display: flex; flex-direction: column; gap: 24px; }
.chat-viewport, .feed-viewport { display: flex; min-width: 0; flex-direction: column; gap: 24px; }
.feed-page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.feed-page-header > div { min-width: 0; flex: 1; }
.feed-page-header h1 { margin-top: 8px; }
.feed-page-header .channel-description { margin-top: 10px; }
.feed-page-header > button { flex-shrink: 0; }
.feed-eyebrow, .eyebrow { color: var(--color-brand-primary); font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.feed-page-header h1, .feed-title, .channel-info-title { color: var(--color-text-primary); font-size: 32px; font-weight: 650; letter-spacing: -1px; line-height: 1.2; overflow-wrap: anywhere; }
.feed-page-header p, .feed-description { max-width: 60ch; color: var(--color-text-muted); font-size: 14px; line-height: 1.65; }
.feed-page-header .eyebrow { color: var(--color-brand-primary); font-size: 11px; font-weight: 600; line-height: 1.5; }
.feed-toolbar { display: flex; align-items: flex-end; gap: 12px; }
.feed-toolbar .feed-search-wrap { flex: 1; }
.feed-toolbar > .form-group, .feed-toolbar > label { flex: 0 0 172px; }
.feed-meta { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; color: var(--color-text-muted); font-size: 12px; }
.message-feed-container { min-width: 0; }
.page-footer { max-width: 1440px; margin: 0 auto; padding: 0 32px 32px; color: var(--color-text-muted); font-size: 12px; line-height: 1.65; }
.mobile-category-strip, .mobile-tab-bar, .mobile-bottom-nav { display: none; }
.drawer-backdrop { position: fixed; inset: 0; z-index: var(--z-modal-backdrop); background: var(--color-bg-overlay); visibility: hidden; opacity: 0; pointer-events: none; transition: opacity var(--transition-normal), visibility var(--transition-normal); }
.drawer-backdrop.open, .drawer-backdrop.active { visibility: visible; opacity: 1; pointer-events: auto; }
.mobile-drawer, .drawer-content { position: fixed; z-index: var(--z-modal); top: 0; bottom: 0; left: 0; width: min(340px, calc(100vw - 32px)); padding: max(20px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); background: var(--color-bg-surface); overflow-y: auto; overscroll-behavior: contain; visibility: hidden; transform: translateX(-100%); transition: transform var(--transition-normal), visibility var(--transition-normal); }
.mobile-drawer.open, .mobile-drawer.active, .drawer-content.open, .drawer-content.active { visibility: visible; transform: translateX(0); }
.drawer-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 24px; }
.drawer-brand { font-size: 17px; font-weight: 600; }
.drawer-user-card { display: flex; align-items: center; gap: 12px; padding: 16px; margin-bottom: 24px; border-radius: 8px; background: var(--color-bg-surface-subtle); }
.drawer-user-info { display: grid; gap: 4px; min-width: 0; }
.drawer-nickname-label { font-weight: 600; overflow-wrap: anywhere; }
.drawer-edit-nick-btn { padding: 4px 0; background: none; border: 0; color: var(--color-brand-primary); text-align: left; font-size: 12px; }
.drawer-nav, .drawer-cities, .drawer-footer-actions { margin-top: 24px; }
.drawer-heading { margin-bottom: 12px; }
.drawer-channel-list { display: grid; gap: 4px; padding: 0; list-style: none; }
.drawer-channel-link { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 12px; border-radius: 8px; color: var(--color-text-secondary); text-decoration: none; }
.drawer-channel-link.active { color: var(--color-brand-primary-text); background: var(--color-brand-primary-light); }
.drawer-channel-link .badge-count { margin-left: auto; }
.drawer-city-chips { display: flex; gap: 8px; flex-wrap: wrap; }
body.modal-open { overflow: hidden; }
@media (min-width: 1280px) {
  .sidebar .sidebar-resource-card { display: none; }
}
@media (max-width: 1279px) {
  .app-layout, .app-container { grid-template-columns: 224px minmax(0, 1fr); }
  .guide-sidebar, .survival-guide-sidebar { display: none; }
}
@media (max-width: 959px) {
  :root { --header-height: 56px; }
  html { scroll-padding-top: 72px; }
  .app-header { min-height: 56px; padding: 6px 20px; gap: 16px; }
  .header-left, .header-right { gap: 8px; }
  .brand-logo { font-size: 17px; gap: 8px; }
  .brand-emblem { width: 30px; height: 30px; }
  .mobile-menu-toggle, .mobile-menu-btn { display: inline-flex; }
  .header-active-channel, .nickname-display, .edit-badge-icon, .nickname-edit-icon { display: none; }
  .header-right .nickname-pill { width: 44px; padding: 5px; border-color: transparent; }
  .app-layout, .app-container { display: block; max-width: 800px; padding: 28px 24px 32px; }
  .sidebar, .app-sidebar { display: none; }
  .mobile-category-strip { display: block; padding: 10px 24px; background: var(--color-bg-surface); border-bottom: 1px solid var(--color-border-subtle); overflow-x: auto; scrollbar-width: none; }
  .mobile-tabs-scroll { display: flex; align-items: center; flex-wrap: nowrap; gap: 8px; width: max-content; min-width: 100%; }
  .page-footer { max-width: 800px; padding-inline: 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}
@media (max-width: 767px) {
  .header-right .btn-guide-header { display: none; }
}
@media (max-width: 599px) {
  .app-header { gap: 8px; padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); }
  .brand-logo { font-size: 16px; letter-spacing: -.5px; gap: 7px; }
  .header-right { gap: 4px; }
  .brand-emblem, .brand-tagline, .btn-lang-toggle > .icon { display: none; }
  .feed-page-header { align-items: flex-start; flex-direction: column; gap: 16px; }
  .header-right .btn-guide-header, .nickname-display, .edit-badge-icon, .nickname-edit-icon { display: none; }
  .app-layout, .app-container { padding: 24px 16px 32px; }
  .chat-viewport, .feed-viewport { gap: 20px; }
  .feed-page-header h1, .feed-title, .channel-info-title { font-size: 28px; letter-spacing: -.8px; }
  .feed-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .feed-toolbar > .form-group, .feed-toolbar > label { flex: auto; }
  .mobile-category-strip { padding: 8px 16px; }
  .page-footer { padding-inline: 16px; }
}
@media (max-width: 359px) {
  .brand-logo { font-size: 14px; }
  .brand-emblem { display: none; }
  .app-layout, .app-container { padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

.mobile-category-strip::-webkit-scrollbar { display: none; }
