@font-face {
  font-family: 'NanumSquareNeo';
  src: url('https://cdn.jsdelivr.net/gh/projectnoonnu/noonfonts_11-01@1.0/NanumSquareNeo-Variable.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: 'NanumSquareNeo', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 17px; font-weight: 500; line-height: 1.6;
  margin: 0; min-height: 100vh;
}
button, input, select, textarea { font-family: inherit; }
h1, h2, h3, .font-serif { font-family: 'NanumSquareNeoExtraBold', 'NanumSquareNeoBold', 'NanumSquareNeo', sans-serif; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.economic-divider { border-top: 2px solid #111827; border-bottom: 1px solid #111827; height: 4px; }
.brand { display: block; min-height: 44px; }
.brand > span:first-child { line-height: 1.2; display: block; }

/* layout */
#shell { display: block; }
#main { padding-bottom: 88px; }
@media (min-width: 768px) {
  #main { max-width: 760px; margin: 0 auto; width: 100%; }
}
@media (min-width: 1024px) {
  #shell:not(.is-auth) { display: grid; grid-template-columns: 230px minmax(0, 1fr) 300px; }
  #leftCol, #rightCol { display: flex; }
  #main { max-width: none; margin: 0; padding-bottom: 32px; }
  #loungeChips, #bottomNav { display: none !important; }
}
@media (max-width: 1023px) {
  #loungeChips:not(.hidden) { display: flex; }
  #bottomNav:not(.hidden) { display: flex; }
}
#leftCol, #rightCol { display: none; align-self: start; flex-direction: column; gap: 20px; }
#leftCol { border-right: 1px solid #E5E7EB; padding-right: 24px; }
#loungeNav { display: flex; flex-direction: column; gap: 4px; }
#shell.is-auth #leftCol, #shell.is-auth #rightCol { display: none !important; }
#shell.is-auth #main { max-width: 960px; margin: 0 auto; }

/* buttons, fields, tags */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; min-width: 44px; padding: 0 16px; border-radius: 8px;
  border: 1px solid transparent; font-size: 17px; font-weight: 700; cursor: pointer;
  background: #fff; color: #111827; text-align: center;
}
.btn:focus-visible, .field:focus-visible, .chip:focus-visible, .navlink:focus-visible, a:focus-visible { outline: 3px solid #C2410C; outline-offset: 2px; }
.btn-primary { background: #C2410C; color: #fff; }
.btn-primary:hover { background: #9A3412; }
.btn-ghost { border-color: #D1D5DB; background: #fff; }
.btn-ghost:hover { background: #F3F4F6; }
.btn-sm { min-height: 44px; padding: 0 12px; font-size: 16px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-on { background: #FFF7ED; border-color: #C2410C; color: #C2410C; }
.lbl { display: block; font-weight: 700; margin: 14px 0 6px; }
.field {
  display: block; width: 100%; min-height: 48px; padding: 10px 12px; font-size: 16px;
  border: 1px solid #9CA3AF; border-radius: 8px; background: #fff; color: #111827; line-height: 1.5;
}
textarea.field { resize: vertical; }
.hint { font-size: 15px; color: #6B7280; margin: 6px 0 0; }
.err { color: #B91C1C; font-weight: 700; margin: 10px 0 0; }
.tag {
  display: inline-block; font-size: 15px; line-height: 1.4; padding: 0 6px; border-radius: 0;
  background: #FFF7ED; color: #C2410C; border: 1px solid #FDBA74; font-weight: 700;
}
.tag-plain { background: #F3F4F6; color: #374151; border-color: #D1D5DB; }
.who { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.who-nick { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
@media (min-width: 768px) { .who-nick { max-width: 200px; } }
#userBox:not(.hidden) { display: flex; }

/* cards */
.card { background: #fff; border: 1px solid #E5E7EB; border-radius: 0; padding: 16px; }
@media (min-width: 768px) { .card { padding: 24px; } }
.card + .card, .stack > * + * { margin-top: 20px; }
.card-title { font-size: 21px; line-height: 1.4; margin: 0 0 8px; }
.muted { color: #6B7280; }
.meta { font-size: 15px; color: #6B7280; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.page-title { font-size: 26px; line-height: 1.3; margin: 0 0 14px; }
.note { background: #FFF7ED; border: 1px solid #FDBA74; padding: 12px 14px; margin: 0 0 16px; }
.empty { text-align: center; padding: 36px 12px; color: #4B5563; }
.empty strong { display: block; font-size: 19px; color: #111827; margin-bottom: 4px; }

/* lounge nav */
.navlink {
  display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 0 12px;
  border-radius: 8px; font-weight: 700;
}
.navlink:hover { background: #F3F4F6; }
.navlink[aria-current="page"] { background: #FFF7ED; color: #C2410C; }
.navlink i { width: 20px; text-align: center; color: #6B7280; }
.navlink[aria-current="page"] i { color: #C2410C; }
.chips { gap: 8px; overflow-x: auto; padding: 0 0 12px; margin: 0 -4px; -webkit-overflow-scrolling: touch; }
.chip {
  flex: none; display: inline-flex; align-items: center; min-height: 44px; padding: 0 14px; border-radius: 8px;
  border: 1px solid #D1D5DB; background: #fff; font-weight: 700; white-space: nowrap; font-size: 16px; cursor: pointer;
}
.chip[aria-current="page"], .chip[aria-pressed="true"] { background: #C2410C; border-color: #C2410C; color: #fff; }

/* bottom nav */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: #fff; border-top: 1px solid #111827;
  padding-bottom: env(safe-area-inset-bottom);
}
.bottom-nav a {
  flex: 1; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; font-size: 15px; font-weight: 700; color: #4B5563;
}
.bottom-nav a[aria-current="page"] { color: #C2410C; }
body #chatBtn { bottom: 76px; }
@media (min-width: 1024px) { body #chatBtn { bottom: 16px; } }
@media (max-width: 1023px) { body #chatPanel { bottom: 144px; height: min(620px, calc(100dvh - 170px)); } }

/* toast */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 80px; z-index: 60; max-width: min(92vw, 520px);
  background: #111827; color: #fff; padding: 12px 16px; border-radius: 8px; font-weight: 700;
}
@media (min-width: 1024px) { .toast { bottom: 24px; } }

/* dialogs */
.dlg { border: 1px solid #111827; border-radius: 0; padding: 20px; width: min(92vw, 460px); color: #111827; }
.dlg::backdrop { background: rgba(17, 24, 39, .5); }
.dlg-title { font-size: 21px; margin: 0 0 8px; }
.dlg-text { margin: 0 0 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.temp-pw { display: block; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 20px; padding: 12px; background: #F3F4F6; border: 1px solid #D1D5DB; word-break: break-all; user-select: all; }

/* auth */
.auth-wrap { display: grid; gap: 24px; padding-top: 8px; }
@media (min-width: 768px) { .auth-wrap { grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; padding-top: 24px; } }
.auth-wrap h2 { font-size: 28px; line-height: 1.35; margin: 0 0 10px; }
.tabs { display: flex; gap: 8px; margin-bottom: 8px; }
.tabs .chip { flex: 1; justify-content: center; }
.pw-row { display: flex; gap: 8px; }
.pw-row .field { flex: 1; }
.radio-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-row label { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 1px solid #9CA3AF; border-radius: 8px; font-weight: 700; cursor: pointer; background: #fff; }
.radio-row input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.radio-row label:has(input:checked) { background: #FFF7ED; border-color: #C2410C; color: #C2410C; }
.radio-row label:has(input:focus-visible) { outline: 3px solid #C2410C; outline-offset: 2px; }

/* poll */
.poll-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 12px; padding-bottom: 10px; border-bottom: 1px solid #E5E7EB; }
.poll-q { font-size: 22px; line-height: 1.45; margin: 14px 0 12px; }
.gauge { display: flex; height: 18px; background: #E5E7EB; overflow: hidden; border: 1px solid #D1D5DB; }
.gauge-good { background: #4B5563; transition: width .4s; }
.gauge-bad { background: #C2410C; transition: width .4s; }
.gauge-legend { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; font-weight: 700; }
.gauge-legend span:last-child { text-align: right; color: #C2410C; }
.vote-grid { display: grid; gap: 10px; margin: 16px 0; }
@media (min-width: 768px) { .vote-grid { grid-template-columns: 1fr 1fr; } }
.vote-grid .btn { min-height: 52px; }
.best { display: grid; gap: 10px; margin: 6px 0 16px; }
@media (min-width: 768px) { .best { grid-template-columns: 1fr 1fr; } }
.best > div { border: 1px solid #E5E7EB; padding: 10px 12px; background: #FAFAFA; }
.best p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sep { border: 0; border-top: 1px solid #E5E7EB; margin: 16px 0; }

/* feed */
.feed-head { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.feed-row { display: flex; flex-wrap: wrap; gap: 8px; }
.post-item { display: block; background: #fff; border-top: 1px solid #E5E7EB; padding: 14px 4px; }
.post-item:first-child { border-top: 2px solid #111827; }
.post-item a.post-link { display: block; min-height: 44px; }
.post-item a.post-link:hover .post-title { color: #C2410C; }
.post-title { font-size: 20px; line-height: 1.4; margin: 2px 0; font-weight: 800; overflow-wrap: anywhere; }
.post-preview { margin: 2px 0 6px; color: #374151; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.blinded { color: #6B7280; font-style: italic; }
.list-box { background: #fff; border: 1px solid #E5E7EB; border-top: 0; padding: 0 16px; }
.post-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 16px 0; font-size: 18px; line-height: 1.75; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* comments */
.comment { border-top: 1px solid #E5E7EB; padding: 12px 0; }
.comment-body { margin: 4px 0 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -8px; }
.comment-actions .btn { border: 0; background: none; color: #4B5563; font-size: 16px; min-height: 44px; padding: 0 10px; }
.comment-actions .btn:hover { color: #C2410C; }
.comment-actions .liked { color: #C2410C; }
.stance-good { background: #F3F4F6; color: #374151; border-color: #9CA3AF; }

/* admin */
.admin-grid { display: grid; gap: 20px; }
@media (min-width: 1024px) { .admin-grid { grid-template-columns: 1fr; } }
.row-item { border-top: 1px solid #E5E7EB; padding: 12px 0; display: grid; gap: 8px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0 0; }
.stat { background: #FAFAFA; border: 1px solid #E5E7EB; padding: 8px 10px; }
.stat strong { display: block; font-size: 22px; color: #C2410C; }
.spin { text-align: center; padding: 32px 0; color: #6B7280; }

.tag, .btn, .chip { white-space: nowrap; }
.chips { scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.brand-sub { display: none; }
@media (min-width: 768px) { .brand-sub { display: block; } }
@media (max-width: 767px) { .who-nick { max-width: 64px; } #logoutBtn { padding: 0 10px; font-size: 16px; } }

.brand { white-space: nowrap; flex: none; }
@media (max-width: 767px) { .brand .font-serif { font-size: 21px; } .who { gap: 4px; flex-direction: column; align-items: flex-start; gap: 0; } .who-nick { max-width: 80px; } #userBox { gap: 6px; } }

@media (min-width: 1024px) { #shell:not(.is-auth) #leftCol, #shell:not(.is-auth) #rightCol { display: flex; } }
.tag:empty { display: none; }

@media (min-width: 1024px) { #leftCol { grid-column: 1; grid-row: 1; } #main { grid-column: 2; grid-row: 1; } #rightCol { grid-column: 3; grid-row: 1; } }
#rightCol .card, .admin-grid .card { margin-top: 0 !important; }
.nb { white-space: nowrap; }
.stat { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.stat strong { order: 2; }
.stat span { white-space: nowrap; }
.field::placeholder { color: #6B7280; opacity: 1; }
.chips { max-width: 100%; }
#view, #main { min-width: 0; max-width: 100%; }
.gauge-legend { flex-direction: column; }
.gauge-legend span:last-child { text-align: left; }
@media (min-width: 768px) { .gauge-legend { flex-direction: row; } .gauge-legend span:last-child { text-align: right; } }
.btn-on[disabled] { opacity: 1; }

/* the right column already shows the badge card on wide screens */
@media (min-width: 1024px) { .note-narrow { display: none; } }

/* phone: the bottom nav already has the admin entry, the header would overflow */
@media (max-width: 767px) { #adminLink { display: none !important; } }
