:root {
  --bg: #050505;
  --surface: #111111;
  --surface-soft: #1a1a1a;
  --surface-raised: #202020;
  --text: #f5f5f5;
  --muted: #b8b8b8;
  --line: #2d2d2d;
  --warm: #d7b66f;
  --green: #82c783;
  --bronze: #c79561;
  --danger: #f08080;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.42);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family:
    "Pretendard",
    "Apple SD Gothic Neo",
    "Malgun Gothic",
    "Noto Sans KR",
    sans-serif;
  background: var(--bg);
  color: var(--text);
}

a {
  color: inherit;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

[hidden] {
  display: none !important;
}

.page {
  width: min(100% - 32px, 1180px);
  margin: 0 auto;
  padding: 34px 0 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
  background: #050505;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 0.95rem;
}

.topnav a {
  text-decoration: none;
}

.topnav a:hover {
  color: var(--text);
}

.hero {
  margin-bottom: 28px;
  padding: clamp(28px, 5vw, 52px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #080808;
  background-image: url("https://firebasestorage.googleapis.com/v0/b/jgstudiotra.firebasestorage.app/o/game%2FBC2333_OSA%2Fgame%2Fimg%2Ftitles1%2FLayer1_0.png?alt=media");
  background-position: center;
  background-size: cover;
  box-shadow: var(--shadow);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.86);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--warm);
  font-size: 0.86rem;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  letter-spacing: 0;
}

h1 {
  margin: 0;
  max-width: 760px;
  font-size: clamp(2.25rem, 6vw, 4.8rem);
  line-height: 1.05;
}

.intro {
  margin: 18px 0 0;
  max-width: 720px;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.8;
  word-break: keep-all;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 24px;
}

.section {
  margin-top: 28px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin: 0;
  font-size: clamp(1.55rem, 3vw, 2.3rem);
}

.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.count {
  min-width: 64px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--warm);
  text-align: center;
  white-space: nowrap;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-raised);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}

.button:hover {
  border-color: rgba(255, 255, 255, 0.38);
}

.button-primary {
  border-color: #ffffff;
  background: #ffffff;
  color: #080808;
}

.button-secondary {
  background: transparent;
}

.button-danger {
  border-color: rgba(240, 128, 128, 0.65);
  background: rgba(240, 128, 128, 0.1);
  color: #ffd0d0;
}

.era-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.era-button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.era-button strong {
  color: var(--warm);
}

.era-button.is-active {
  border-color: #ffffff;
  background: #ffffff;
  color: #080808;
}

.era-button.is-active strong {
  color: #080808;
}

.game-panel,
.diary-panel,
.form-panel,
.admin-panel,
.admin-card,
.diary-card,
.diary-empty {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.game-panel {
  overflow: hidden;
}

.game-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-soft);
}

.game-toolbar h2 {
  margin: 0;
  font-size: 1.05rem;
}

.game-toolbar p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.game-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.game-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1008 / 624;
  background: #000000;
}

.game-placeholder {
  display: grid;
  place-content: center;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.game-placeholder strong {
  color: var(--text);
  font-size: clamp(1.2rem, 3vw, 2rem);
}

.game-placeholder span {
  max-width: 560px;
  line-height: 1.65;
}

.game-frame-wrap iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

.diary-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.82fr) minmax(0, 1.18fr);
  gap: 18px;
  align-items: start;
}

.diary-layout > *,
.diary-list,
.diary-card,
.diary-empty {
  min-width: 0;
}

.form-panel {
  padding: 18px;
}

.form-panel label,
.admin-edit-box label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
}

.form-panel input,
.form-panel select,
.form-panel textarea,
.admin-toolbar select,
.admin-edit-box input,
.admin-edit-box textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080808;
  color: var(--text);
}

.form-panel input,
.form-panel select,
.admin-toolbar select,
.admin-edit-box input {
  min-height: 44px;
  padding: 0 12px;
}

.form-panel textarea,
.admin-edit-box textarea {
  min-height: 180px;
  padding: 12px;
  line-height: 1.6;
  resize: vertical;
}

.check-row {
  display: flex !important;
  grid-template-columns: none !important;
  align-items: flex-start;
  gap: 10px !important;
  color: var(--muted);
  line-height: 1.55;
}

.check-row input {
  width: 18px;
  min-width: 18px;
  height: 18px;
  margin-top: 3px;
}

.form-status,
.admin-feedback {
  min-height: 24px;
  margin: 10px 0 0;
  color: var(--warm);
  line-height: 1.5;
}

.diary-panel {
  min-height: 360px;
  min-width: 0;
  padding: 16px;
}

.diary-list {
  display: grid;
  gap: 12px;
}

.diary-card,
.diary-empty,
.admin-card {
  padding: 18px;
}

.diary-card {
  box-shadow: none;
}

.diary-card-head,
.admin-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.diary-card h3,
.diary-empty h3,
.admin-card h2,
.admin-card h3 {
  margin: 0 0 10px;
  overflow-wrap: anywhere;
}

.diary-card p,
.diary-empty p,
.admin-card p,
.diary-content-preview {
  margin: 0;
  color: var(--muted);
  line-height: 1.72;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: rgba(215, 182, 111, 0.12);
  color: var(--warm);
  font-size: 0.82rem;
  font-weight: 800;
}

.badge-published {
  background: rgba(130, 199, 131, 0.14);
  color: var(--green);
}

.badge-pending {
  background: rgba(215, 182, 111, 0.12);
  color: var(--warm);
}

.badge-hidden {
  background: rgba(240, 128, 128, 0.1);
  color: var(--danger);
}

.admin-panel {
  padding: 18px;
}

.admin-login {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}

.admin-profile {
  width: 100%;
  color: var(--muted);
  line-height: 1.6;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.admin-toolbar select {
  max-width: 180px;
}

.admin-list {
  display: grid;
  gap: 12px;
}

.admin-card {
  box-shadow: none;
}

.admin-meta {
  margin-top: 12px !important;
  font-size: 0.92rem;
}

.private-info {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #080808;
  color: var(--muted);
  line-height: 1.65;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.admin-edit-box {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

@media (max-width: 820px) {
  .topbar,
  .section-head,
  .game-toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .era-buttons,
  .diary-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 24px;
  }

  .topnav {
    flex-wrap: wrap;
  }
}

@media (max-width: 560px) {
  .page {
    width: min(100% - 22px, 1180px);
    padding-top: 22px;
  }

  .hero-actions,
  .admin-actions,
  .admin-login {
    flex-direction: column;
    align-items: stretch;
  }

  .button,
  .era-button {
    width: 100%;
  }

  .diary-card-head,
  .admin-card-head {
    flex-direction: column;
  }
}
