:root {
  color-scheme: dark;
  font-family: "Cascadia Mono", "D2Coding", "Noto Sans Mono CJK KR", monospace;
  background: #050705;
  color: #d5e4d8;
  font-size: 15px;
  line-height: 1.65;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --green: #69f995;
  --green-dim: #86b995;
  --line: #203b28;
  --panel: #0a100c;
  --muted: #8a9b8e;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(ellipse at 50% -18%, rgb(31 82 45 / 20%), transparent 58%),
    #050705;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.terminal {
  display: flex;
  flex-direction: column;
  width: min(100%, 1040px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px clamp(16px, 4vw, 48px) 18px;
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 4px 0 22px;
}

.brand {
  display: grid;
  justify-items: start;
  gap: 2px;
  border: 0;
  padding: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.brand-mark {
  color: var(--green);
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.brand-divider {
  padding: 0 0.3em;
  color: #497658;
}

.brand-version,
.account-status,
.eyebrow,
.section-count,
.system-note,
footer {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
}

.account-status {
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: right;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 10px rgb(105 249 149 / 65%);
}

#site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
}

.nav-button,
.action-button,
.text-link,
.post-title-link {
  border: 1px solid var(--line);
  border-radius: 2px;
  background: #090e0a;
  color: var(--green-dim);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease, background 120ms ease;
}

.nav-button {
  padding: 6px 10px;
  font-size: 0.82rem;
}

.nav-highlight {
  border-color: #376644;
  color: var(--green);
}

.nav-button:hover,
.nav-button:focus-visible,
.action-button:hover,
.action-button:focus-visible,
.text-link:hover,
.text-link:focus-visible,
.post-title-link:hover,
.post-title-link:focus-visible {
  border-color: var(--green);
  background: #102016;
  color: #caffd8;
}

.notice {
  margin-top: 16px;
  border: 1px solid #315b3b;
  border-left: 3px solid var(--green);
  padding: 10px 13px;
  background: #0b140e;
  color: #b4eac2;
}

.notice-error {
  border-color: #784044;
  border-left-color: #f28585;
  background: #190d0e;
  color: #ffc3c3;
}

.screen {
  flex: 1;
  min-height: 320px;
  padding: 28px 0 44px;
}

.page-content {
  width: 100%;
  animation: appear 180ms ease-out;
}

.narrow-content {
  width: min(100%, 680px);
  margin: 0 auto;
}

.welcome-panel {
  position: relative;
  overflow: hidden;
  margin-bottom: 36px;
  border: 1px solid var(--line);
  padding: clamp(24px, 5vw, 46px);
  background:
    linear-gradient(115deg, rgb(19 48 27 / 65%), transparent 67%),
    var(--panel);
}

.build-profile {
  position: relative;
  z-index: 1;
  margin: 0 0 30px;
  border: 1px solid #294431;
  padding: 15px 17px 12px;
  background: rgb(3 7 4 / 76%);
}

.build-profile-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 5px 12px;
  margin-bottom: 11px;
}

.build-profile-heading .eyebrow {
  margin: 0;
  color: var(--green);
}

.stack-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
}

.stack-item {
  min-width: 0;
  border-left: 1px solid #294431;
  padding: 2px 9px;
}

.stack-item dt {
  color: #829987;
  font-size: 0.67rem;
  letter-spacing: 0.08em;
}

.stack-item dd {
  margin: 3px 0 0;
  color: #c6e2cd;
  font-size: 0.79rem;
  overflow-wrap: anywhere;
}

.architecture-note {
  margin: 10px 0 0;
  color: #839187;
  font-size: 0.72rem;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.architecture-note + .architecture-note {
  margin-top: 3px;
}

.welcome-panel::after {
  position: absolute;
  right: 28px;
  bottom: -35px;
  color: rgb(105 249 149 / 5%);
  content: "BBS";
  font-size: clamp(6rem, 18vw, 12rem);
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--green-dim);
}

.welcome-panel h1,
.page-heading h1 {
  margin: 0;
  color: #e5f5e9;
  font-size: clamp(1.55rem, 4vw, 2.25rem);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 1.35;
}

.welcome-copy,
.page-description {
  margin: 9px 0 0;
  color: var(--muted);
}

.welcome-user {
  display: inline-block;
  margin: 22px 0 0;
  border: 1px solid var(--line);
  padding: 7px 11px;
  color: var(--green);
}

.welcome-actions,
.form-actions,
.list-toolbar,
.back-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.welcome-actions {
  position: relative;
  z-index: 1;
  margin-top: 24px;
}

.action-button {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  padding: 7px 14px;
}

.action-primary {
  border-color: #60d986;
  background: #15331e;
  color: #caffd8;
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.section-heading h2 {
  margin: 0;
  color: #dcebe0;
  font-size: 1.05rem;
}

.board-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.board-card {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: start;
  gap: 4px 12px;
  border: 1px solid var(--line);
  padding: 17px;
  background: rgb(10 16 12 / 85%);
}

.board-number {
  grid-row: span 2;
  color: #487655;
  font-size: 0.82rem;
}

.board-copy h3 {
  margin: 0;
  color: #d7e9dc;
  font-size: 0.97rem;
  font-weight: 500;
}

.board-copy p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.79rem;
}

.text-link {
  justify-self: start;
  border-color: transparent;
  padding: 5px 0;
  background: transparent;
  color: var(--green);
}

.board-card .text-link {
  grid-column: 2;
  margin-top: 6px;
}

.system-note {
  margin: 24px 0 0;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.page-heading {
  margin-bottom: 24px;
}

.page-heading h1 {
  font-size: clamp(1.45rem, 3vw, 1.9rem);
}

.list-toolbar {
  justify-content: space-between;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 12px 0;
}

.muted-copy {
  color: var(--muted);
  font-size: 0.84rem;
}

.post-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.post-row {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) minmax(90px, 140px) minmax(125px, 180px) 78px;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  border-bottom: 1px solid #16261a;
  padding: 9px 4px;
}

.post-number,
.post-author,
.post-date,
.post-views,
.post-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.upload-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px 14px;
  margin-top: 18px;
  border: 1px solid var(--line);
  padding: 16px;
  background: var(--panel);
}

.upload-panel label {
  grid-column: 1 / -1;
  color: #c8d8cc;
  font-size: 0.86rem;
}

.upload-panel input[type="file"] {
  width: 100%;
  min-width: 0;
  color: var(--muted);
  font: inherit;
  font-size: 0.82rem;
}

.upload-panel input[type="file"]::file-selector-button {
  margin-right: 10px;
  border: 1px solid #31583b;
  padding: 7px 10px;
  background: #0a100c;
  color: var(--green-dim);
  font: inherit;
  cursor: pointer;
}

.file-list {
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.file-row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 72px;
  border-bottom: 1px solid #1b2c1f;
  padding: 12px 4px;
}

.file-icon {
  display: grid;
  width: 44px;
  height: 36px;
  place-items: center;
  border: 1px solid #31583b;
  color: var(--green);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
}

.file-details {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.file-name {
  overflow: hidden;
  color: #d7e9dc;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-name:hover,
.file-name:focus-visible {
  color: var(--green);
}

.file-meta {
  color: var(--muted);
  font-size: 0.74rem;
}

.file-download {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 0.8rem;
}

.post-title-link {
  justify-self: start;
  overflow: hidden;
  border: 0;
  padding: 5px 0;
  background: transparent;
  color: #d7e9dc;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-title-link:hover,
.post-title-link:focus-visible {
  background: transparent;
  color: var(--green);
}

.empty-state {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 1px dashed #294431;
  margin-top: 22px;
  padding: 48px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state p,
.empty-state h1 {
  margin: 0;
}

.empty-state h1 {
  color: #e5f5e9;
  font-size: 1.3rem;
}

.empty-mark {
  color: #558365;
}

.empty-state .text-link {
  margin-top: 8px;
}

.back-row {
  margin-top: 20px;
}

.form-panel {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  padding: clamp(18px, 4vw, 28px);
  background: var(--panel);
}

.form-panel label {
  margin-top: 7px;
  color: #c8d8cc;
  font-size: 0.87rem;
}

.form-panel input,
.form-panel select,
.form-panel textarea {
  width: 100%;
  border: 1px solid #2a4932;
  border-radius: 2px;
  outline: none;
  padding: 10px 12px;
  background: #050805;
  color: #e0efe4;
}

.form-panel input:focus,
.form-panel select:focus,
.form-panel textarea:focus {
  border-color: var(--green-dim);
  box-shadow: 0 0 0 2px rgb(105 249 149 / 10%);
}

.form-panel input::placeholder,
.form-panel textarea::placeholder {
  color: #66766a;
}

.form-panel textarea {
  min-height: 200px;
  resize: vertical;
  white-space: pre-wrap;
}

.form-actions {
  margin-top: 12px;
}

.form-switch,
.field-hint {
  color: var(--muted);
  font-size: 0.8rem;
}

.post-header {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 20px 0;
}

.post-detail-title {
  margin: 0;
  color: #e5f5e9;
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 500;
  overflow-wrap: anywhere;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-top: 10px;
}

.post-content {
  min-height: 180px;
  margin: 0;
  border-bottom: 1px solid var(--line);
  padding: 24px 0 34px;
  color: #d2e2d6;
  font: inherit;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding-top: 13px;
}

button:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

[aria-busy="true"] {
  cursor: progress;
}

[hidden] {
  display: none !important;
}

@keyframes appear {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 760px) {
  .board-grid {
    grid-template-columns: 1fr;
  }

  .stack-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 12px;
  }

  .post-row {
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 5px 10px;
  }

  .file-row {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 9px;
  }

  .file-icon {
    width: 38px;
    height: 32px;
  }

  .file-download {
    grid-column: 2;
    justify-self: start;
  }

  .post-author {
    grid-column: 2;
  }

  .post-date {
    grid-column: 2;
    grid-row: 2;
  }

  .post-views {
    grid-column: 3;
    grid-row: 1 / span 2;
  }
}

@media (max-width: 520px) {
  :root {
    font-size: 14px;
  }

  .terminal {
    padding-top: 17px;
  }

  .terminal-header {
    align-items: flex-start;
    gap: 8px;
  }

  .account-status {
    padding-top: 7px;
    font-size: 0.68rem;
  }

  #site-nav {
    gap: 6px;
  }

  .nav-button {
    padding: 6px 8px;
  }

  .welcome-panel {
    margin-bottom: 28px;
  }

  .build-profile {
    margin-bottom: 24px;
    padding: 13px;
  }

  .stack-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .stack-item {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    align-items: baseline;
    gap: 8px;
  }

  .stack-item dd {
    margin-top: 0;
  }

  .upload-panel {
    grid-template-columns: minmax(0, 1fr);
  }

  .upload-panel label {
    grid-column: auto;
  }

  footer span:last-child {
    text-align: right;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
