:root {
  color-scheme: light;
  --bg: #eef1f5;
  --surface: #ffffff;
  --panel: #f8fafc;
  --text: #20242a;
  --muted: #6b7280;
  --line: #d7dde6;
  --accent: #2563eb;
  --accent-dark: #1d4ed8;
  --danger: #dc2626;
  --ok-bg: #ecfdf5;
  --ok-text: #047857;
  --error-bg: #fef2f2;
  --error-text: #b91c1c;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-size: 18px;
  line-height: 1.45;
  overflow: hidden;
}

button, textarea, input { font: inherit; }
button { cursor: pointer; }

.app {
  width: min(920px, 100%);
  height: 100dvh;
  margin: 0 auto;
  background: var(--surface);
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

h1 {
  margin: 0;
  font-size: 30px;
}

.top-actions {
  display: flex;
  gap: 8px;
}

.secondary, .primary {
  border-radius: 6px;
  padding: 10px 14px;
  font-weight: 700;
}

.secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.primary {
  border: 0;
  background: var(--accent);
  color: #fff;
}

.admin-panel {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}

.admin-panel.show { display: flex; }

.admin-panel input,
.search-panel input,
.write-form-bottom input,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  outline: none;
}

.admin-panel input {
  width: 220px;
  padding: 10px 12px;
}

.feed {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: var(--bg);
}

.feed-meta {
  position: sticky;
  top: -12px;
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
  color: var(--muted);
  font-size: 16px;
  background: linear-gradient(var(--bg) 70%, rgba(238, 241, 245, 0));
}

.posts {
  display: grid;
  gap: 10px;
}

.post {
  width: min(720px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
}

.post-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 15px;
}

.post-actions {
  display: flex;
  gap: 6px;
  flex-wrap: nowrap;
}

.content {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 20px;
}

.owner-delete, .admin-delete {
  border: 0;
  border-radius: 5px;
  color: #fff;
  padding: 6px 8px;
  font-size: 13px;
  font-weight: 700;
}

.owner-delete { background: #4b5563; }
.admin-delete { display: none; background: var(--danger); }
.admin-on .admin-delete { display: inline-flex; }

.empty {
  width: 100%;
  margin: 18px auto;
  padding: 20px 10px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
}

.bottom-bar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 10px 14px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.search-panel {
  display: flex;
  gap: 8px;
  min-width: 0;
}

.search-panel input {
  flex: 1;
  min-width: 0;
  padding: 11px 12px;
}

.write-button { min-width: 96px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 14px;
  background: rgba(17, 24, 39, 0.48);
  z-index: 20;
}

.modal-backdrop.show { display: flex; }

.modal {
  width: min(720px, 100%);
  max-height: 88vh;
  overflow: hidden;
  background: var(--surface);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
}

.alert-modal { width: min(460px, 100%); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.modal-title {
  margin: 0;
  font-size: 22px;
}

.modal-body {
  overflow: auto;
  padding: 14px;
  background: var(--panel);
}

textarea {
  display: block;
  width: 100%;
  min-height: 180px;
  max-height: 42vh;
  resize: vertical;
  padding: 12px;
  font-size: 18px;
}

.write-form-bottom {
  display: grid;
  grid-template-columns: auto 1fr 120px auto;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.write-form-bottom input {
  width: 120px;
  padding: 10px 12px;
  text-align: center;
}

.counter {
  color: var(--muted);
  font-size: 15px;
}

.counter.over {
  color: var(--danger);
  font-weight: 700;
}

.notice {
  display: none;
  padding: 10px 14px;
  font-size: 15px;
}

.notice.show { display: block; }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }
.notice.error { background: var(--error-bg); color: var(--error-text); }

.search-result {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fff;
}

.search-result time {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 14px;
}

.search-result-header {
  margin-bottom: 8px;
}



.alert-message {
  margin: 0;
  font-size: 18px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 560px) {
  body { font-size: 14px; }

  .app { border: 0; }

  .topbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
    padding: 10px 12px;
  }

  h1 {
    font-size: 24px;
    white-space: nowrap;
  }

  .top-actions { gap: 5px; }

  .secondary {
    padding: 6px 7px;
    font-size: 12px;
    white-space: nowrap;
  }

  .primary {
    padding: 9px 10px;
    font-size: 15px;
  }

  .feed { padding: 8px; }

  .post {
    width: 100%;
    padding: 9px;
  }

  .post-header {
    gap: 8px;
    font-size: 13px;
  }

  .content { font-size: 16px; }

  .owner-delete, .admin-delete {
    padding: 4px 6px;
    font-size: 11px;
  }

  .bottom-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 8px;
  }

  .search-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 72px;
  }

  .search-panel input {
    padding: 10px;
    font-size: 15px;
  }

  .write-button {
    width: 100%;
    padding: 10px;
    font-size: 16px;
  }

  .modal-backdrop {
    align-items: flex-end;
    padding: 10px;
  }

  .modal-title { font-size: 18px; }

  .modal-body { padding: 10px; }

  textarea {
    min-height: 150px;
    max-height: 46vh;
    padding: 10px;
    font-size: 15px;
  }

  .write-form-bottom {
    grid-template-columns: 48px minmax(0, 1fr) 78px 72px;
    gap: 6px;
  }

  .write-form-bottom input {
    width: 78px;
    padding: 8px 6px;
    font-size: 13px;
  }

  .submit-post {
    width: 72px;
    padding: 8px 6px;
    font-size: 14px;
  }

  .counter { font-size: 12px; }

  .owner-pin-label {
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .alert-message { font-size: 15px; }
}

