@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

@font-face {
  font-family: "ComicTTF";
  src: url('/static/comic.TTF') format('truetype');
  font-weight: normal;
  font-style: normal;
}

@font-face {
  font-family: "Pixelated MS Sans Serif";
  src: url(https://unpkg.com/98.css@0.1.16/dist/ms_sans_serif.woff) format("woff");
  src: url(https://unpkg.com/98.css@0.1.16/dist/ms_sans_serif.woff2) format("woff2");
  font-weight: 400;
  font-style: normal;
  -webkit-font-smoothing: none;
}

:root {
  --win-bg: #c0c0c0;
  --win-title: #000080;
  --win-border-light: #ffffff;
  --win-border-dark: #808080;
  --win-border-darker: #000000;
  --desktop-bg: #008080;
  --text: #000000;
}

*, html, body {
  margin: 0; padding: 0; box-sizing: border-box;
  -webkit-font-smoothing: none;
}

body {
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
  font-size: 14px;
  background: var(--desktop-bg);
  color: var(--text);
  min-height: 100vh;
}

/* window */
.window {
  background: var(--win-bg);
  border-top: 2px solid var(--win-border-light);
  border-left: 2px solid var(--win-border-light);
  border-right: 2px solid var(--win-border-darker);
  border-bottom: 2px solid var(--win-border-darker);
  box-shadow: 1px 1px 0 var(--win-border-darker);
}

.window-title {
  background: linear-gradient(90deg, var(--win-title), #1084d0);
  color: white;
  padding: 3px 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-weight: bold;
  font-size: 13px;
  user-select: none;
}

.window-controls { display: flex; gap: 2px; }
.window-controls button {
  width: 18px; height: 18px;
  background: var(--win-bg);
  border-top: 2px solid var(--win-border-light);
  border-left: 2px solid var(--win-border-light);
  border-right: 2px solid var(--win-border-dark);
  border-bottom: 2px solid var(--win-border-dark);
  font-size: 10px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding: 0;
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
}

.window-body {
  padding: 8px;
  border-top: 2px solid var(--win-border-dark);
  border-left: 2px solid var(--win-border-dark);
  border-right: 2px solid var(--win-border-light);
  border-bottom: 2px solid var(--win-border-light);
  margin: 2px;
}

.window-statusbar {
  border-top: 2px solid var(--win-border-dark);
  padding: 2px 6px; font-size: 12px;
  display: flex; gap: 8px;
}
.statusbar-section {
  border-top: 2px solid var(--win-border-dark);
  border-left: 2px solid var(--win-border-dark);
  border-right: 2px solid var(--win-border-light);
  border-bottom: 2px solid var(--win-border-light);
  padding: 1px 6px; flex: 1;
}

/* buttons */
.btn {
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
  font-size: 14px; padding: 4px 12px; cursor: pointer;
  background: var(--win-bg);
  border-top: 2px solid var(--win-border-light);
  border-left: 2px solid var(--win-border-light);
  border-right: 2px solid var(--win-border-dark);
  border-bottom: 2px solid var(--win-border-dark);
}
.btn:active {
  border-top: 2px solid var(--win-border-dark);
  border-left: 2px solid var(--win-border-dark);
  border-right: 2px solid var(--win-border-light);
  border-bottom: 2px solid var(--win-border-light);
}
.btn-primary { background: var(--win-bg); color: #000; }

/* form */
.field-row {
  display: flex; align-items: center; gap: 8px; margin-bottom: 6px;
}
.field-row label { min-width: 100px; font-size: 13px; }

input[type="text"], textarea, select {
  font-family: "Pixelated MS Sans Serif", Arial, sans-serif;
  font-size: 13px; padding: 3px 4px;
  border-top: 2px solid var(--win-border-dark);
  border-left: 2px solid var(--win-border-dark);
  border-right: 2px solid var(--win-border-light);
  border-bottom: 2px solid var(--win-border-light);
  background: white; outline: none;
}

/* table */
.data-table {
  width: 100%; border-collapse: collapse; font-size: 13px;
}
.data-table th, .data-table td {
  padding: 3px 6px; text-align: left;
  border-bottom: 1px solid #e0e0e0;
}
.data-table th {
  background: var(--win-bg);
  border-bottom: 2px solid var(--win-border-dark);
  font-weight: bold;
}
.data-table tr:hover { background: #e8e8ff; }

/* ── Iceberg public page ── */

.iceberg-page {
  max-width: 800px;
  margin: 12px auto;
  padding: 0 8px;
}

.iceberg-header {
  text-align: center;
  padding: 12px 0 8px;
}
.iceberg-header h1 {
  font-family: 'ComicTTF', cursive;
  font-size: 32px;
  color: white;
  text-shadow: 2px 2px 0 #000;
  margin-bottom: 4px;
}
.iceberg-header p {
  font-family: 'ComicTTF', cursive;
  color: #ccc;
  font-size: 12px;
}

.iceberg-tier {
  margin-bottom: 2px;
  padding: 10px 12px;
  min-height: 60px;
}
.iceberg-tier-1 { background: #b8d4f0; }
.iceberg-tier-2 { background: #7fb3de; }
.iceberg-tier-3 { background: #4a8cbf; color: white; }
.iceberg-tier-4 { background: #2a5f8f; color: white; }
.iceberg-tier-5 { background: #1a3350; color: white; }
.iceberg-tier-6 { background: #0a0e14; color: #8899aa; }

.iceberg-tier-label {
  font-family: 'VT323', monospace;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 6px;
  text-shadow: 1px 1px 0 rgba(0,0,0,0.2);
}

.iceberg-events {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.iceberg-event {
  background: rgba(255,255,255,0.15);
  border: 1px solid rgba(255,255,255,0.2);
  padding: 4px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.1s;
}
.iceberg-event:hover {
  background: rgba(255,255,255,0.3);
}

.iceberg-event-empty {
  font-style: italic;
  opacity: 0.6;
  font-size: 12px;
}

/* event detail popup */
.iceberg-detail {
  max-height: 300px;
  overflow-y: auto;
}
.iceberg-submission {
  padding: 6px 0;
  border-bottom: 1px solid #e0e0e0;
  font-size: 13px;
  word-break: break-word;
  overflow-wrap: break-word;
}
.iceberg-submission:last-child { border-bottom: none; }
.iceberg-sub-user {
  font-weight: bold;
  color: var(--win-title);
}
.iceberg-sub-date {
  font-size: 11px;
  color: #808080;
}

/* submit button */
.iceberg-submit-btn {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 100;
}

/* modal overlay */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 2000;
  align-items: center;
  justify-content: center;
}
.modal-overlay.active { display: flex; }

/* honeypot */
.hp-field { position: absolute; left: -9999px; }

/* ── Admin page ── */

.admin-layout {
  display: flex;
  height: calc(100vh - 40px);
}

.admin-list {
  width: 280px;
  min-width: 200px;
  flex-shrink: 0;
  border-right: 2px solid var(--win-border-dark);
  overflow-y: auto;
  background: white;
}

.admin-detail {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.admin-detail-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  background: #f8f8f8;
}

.admin-event-item {
  padding: 6px 8px;
  border-bottom: 1px solid #e0e0e0;
  cursor: pointer;
  user-select: none;
}
.admin-event-item:hover { background: #e0e0ff; }
.admin-event-item.active {
  background: var(--win-title);
  color: white;
}
.admin-event-item.active .admin-event-sub { color: #c0c0ff; }

.admin-event-name {
  font-weight: bold;
  font-size: 13px;
}
.admin-event-sub {
  font-size: 11px;
  color: #808080;
}

.admin-sub-card {
  background: white;
  border-top: 2px solid var(--win-border-light);
  border-left: 2px solid var(--win-border-light);
  border-right: 2px solid var(--win-border-dark);
  border-bottom: 2px solid var(--win-border-dark);
  padding: 8px;
  margin-bottom: 6px;
}
.admin-sub-card.pending {
  border-left: 3px solid #ff8800;
}
.admin-sub-meta {
  font-size: 11px;
  color: #808080;
  margin-bottom: 4px;
}
.admin-sub-actions {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-bottom: 1px solid var(--win-border-dark);
  flex-wrap: wrap;
}
.toolbar .separator {
  width: 1px;
  height: 20px;
  background: var(--win-border-dark);
  border-right: 1px solid var(--win-border-light);
}

.tier-badge {
  display: inline-block;
  font-size: 10px;
  padding: 1px 6px;
  font-weight: bold;
}
.tier-badge-1 { background: #b8d4f0; }
.tier-badge-2 { background: #7fb3de; }
.tier-badge-3 { background: #4a8cbf; color: white; }
.tier-badge-4 { background: #2a5f8f; color: white; }
.tier-badge-5 { background: #1a3350; color: white; }
.tier-badge-6 { background: #0a0e14; color: #8899aa; }

/* ── Mobile ── */

@media (max-width: 700px) {
  .iceberg-page { margin: 8px auto; }
  .iceberg-header h1 { font-size: 24px; }

  .admin-layout {
    flex-direction: column;
    height: auto;
  }
  .admin-list {
    width: 100%;
    max-height: 200px;
    border-right: none;
    border-bottom: 2px solid var(--win-border-dark);
  }
  .admin-detail-body {
    min-height: 300px;
  }

  .field-row {
    flex-direction: column;
    align-items: stretch;
  }
  .field-row label { min-width: 0; }

  .modal-overlay .window {
    width: 95vw !important;
    max-width: 95vw !important;
  }
}
