@font-face {
  font-family: "WILDgag-Bold";
  src: url("./assets/WILDgag-Bold.ttf") format("truetype");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

:root {
  --motd-green: #00ce2d;
  --motd-green-dim: rgba(0, 206, 45, 0.8);
  --motd-green-border: rgba(0, 184, 40, 0.9);
  --motd-gold-glow: rgba(255, 215, 0, 0.35);
  --motd-green-glow: rgba(0, 206, 45, 0.55);
  --panel: rgba(20, 20, 20, 0.72);
  --panel-soft: rgba(20, 20, 20, 0.55);
  --panel-2: rgba(40, 40, 40, 0.65);
  --line: rgba(0, 206, 45, 0.55);
  --fg: #ffffff;
  --fg-dim: #c8d0c8;
  --accent: #00ce2d;
  --warn: #ffd54a;
  --ok: #4ee06a;
  --chat: #7fd8ff;
  --event: #ffd54a;
  --admin: #c79bff;
  --hl: rgba(0, 206, 45, 0.35);
  --shadow-panel:
    0 0 28px var(--motd-gold-glow),
    inset 0 0 24px rgba(0, 0, 0, 0.18);
  --font-ui: "Pretendard", "Malgun Gothic", "Segoe UI", system-ui, sans-serif;
  --font-display: "WILDgag-Bold", "Pretendard", "Malgun Gothic", sans-serif;
  --font-log: ui-monospace, "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  color: var(--fg);
  font: 14px/1.45 var(--font-ui);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: #0a120c;
}

body {
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  max-width: 100vw;
  position: relative;
}

.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image: url("./assets/background.gif");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

.bg-layer::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 0%, rgba(0, 206, 45, 0.18), transparent 55%),
    linear-gradient(180deg, rgba(8, 14, 10, 0.55), rgba(8, 14, 10, 0.78));
}

.app-shell {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  padding: 12px 14px 10px;
  gap: 10px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--panel);
  border: 2px solid var(--motd-green-border);
  border-radius: 0;
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px 16px;
  background: var(--panel);
  border: 3px solid var(--motd-green-border);
  border-radius: 0;
  box-shadow: var(--shadow-panel);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  flex: none;
  position: relative;
  overflow: hidden;
}

.topbar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--motd-green), var(--motd-green), transparent);
  opacity: 0.9;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.logo {
  width: 72px;
  height: auto;
  flex: none;
  filter: drop-shadow(0 0 10px rgba(0, 206, 45, 0.45));
}

.brand-text { min-width: 0; }

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: bold;
  letter-spacing: 1px;
  color: var(--motd-green);
  text-shadow:
    2px 2px 4px rgba(0, 0, 0, 1),
    0 0 18px rgba(0, 206, 45, 0.85);
}

.brand .sub {
  display: block;
  margin-top: 4px;
  color: var(--fg-dim);
  font-size: 12.5px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.9);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--panel-soft);
  border: 2px solid var(--motd-green-dim);
  box-shadow: none;
  flex: 1 1 420px;
  max-width: 100%;
}

.controls label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--fg-dim);
  font-size: 12px;
}

.controls select,
.controls button,
.controls input[type="search"],
.controls input[type="datetime-local"] {
  background: var(--panel-2);
  color: var(--fg);
  border: 2px solid rgba(0, 206, 45, 0.55);
  border-radius: 0;
  padding: 6px 10px;
  font: inherit;
  font-size: 12.5px;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.75);
}

.controls select:focus,
.controls input[type="search"]:focus,
.controls input[type="datetime-local"]:focus,
.controls button:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 12px var(--motd-green-glow);
}

.controls button,
.btn-motd {
  cursor: pointer;
  font-weight: 700;
  background: rgba(0, 206, 45, 0.28);
  border-color: var(--motd-green-dim);
  transition: background-color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

.controls button:hover,
.btn-motd:hover {
  border-color: #fff;
  background: rgba(0, 206, 45, 0.5);
  box-shadow: 0 4px 16px var(--motd-green-glow);
}

.search-wrap input {
  width: min(220px, 40vw);
}

.datetime-jump-wrap input[type="datetime-local"] {
  font-variant-numeric: tabular-nums;
  color-scheme: dark;
  min-width: 14.5rem;
}

.chk { user-select: none; }

.ctrl-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.banner {
  padding: 10px 14px;
  background: rgba(60, 40, 10, 0.85);
  color: var(--warn);
  border: 2px solid rgba(255, 213, 74, 0.7);
  font-size: 12.5px;
  flex: none;
  text-shadow: 1px 1px 2px #000;
}
.banner.hidden { display: none; }

.meta {
  padding: 8px 14px;
  color: var(--fg-dim);
  font-size: 12.5px;
  flex: none;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.85);
}

.log-view {
  flex: 1;
  margin: 0;
  padding: 14px 16px 22px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font: 12.5px/1.5 var(--font-log);
  background: rgba(10, 16, 12, 0.78);
  min-height: 0;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.55);
}

.log-view .hl {
  background: var(--hl);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(0, 206, 45, 0.4);
}
.log-view .chat-match-line {
  display: block;
  background: rgba(0, 206, 45, 0.22);
  box-shadow: 0 0 0 1px rgba(0, 206, 45, 0.55);
  border-radius: 3px;
  margin: 0 -4px;
  padding: 0 4px;
}
.log-view .line-event { color: var(--event); }
.log-view .line-admin { color: var(--admin); }
.log-view .line-chat { color: var(--chat); }
.log-view .empty {
  color: var(--fg-dim);
  font-family: var(--font-ui);
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  color: var(--fg-dim);
  font-size: 11.5px;
  flex: none;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.85);
}

body.embed .bg-layer {
  opacity: 0.35;
}
body.embed .topbar {
  padding: 10px 12px;
  border-width: 2px;
}
body.embed .brand .sub { display: none; }
body.embed .logo { width: 44px; }
body.embed .brand h1 { font-size: 18px; }
body.embed footer { display: none; }
body.embed .app-shell {
  padding: 8px;
  gap: 8px;
  max-width: none;
}

/* ---------- mobile / narrow viewports ---------- */

@media (max-width: 720px) {
  .app-shell {
    padding: 8px;
    gap: 8px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .brand { gap: 10px; }
  .logo { width: 56px; }
  .brand h1 { font-size: 20px; }
  .brand .sub { font-size: 11.5px; }

  .controls {
    gap: 8px;
    padding: 10px;
    flex: 1 1 auto;
  }

  .controls label {
    width: 100%;
    justify-content: space-between;
    flex-wrap: wrap;
    font-size: 12.5px;
    gap: 8px;
  }

  .controls select,
  .controls button,
  .controls input[type="search"],
  .controls input[type="datetime-local"],
  .nav-link {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 14px;
  }

  .controls select,
  .controls input[type="search"],
  .controls input[type="datetime-local"] {
    flex: 1;
    min-width: 0;
    width: auto;
  }

  .datetime-jump-wrap {
    width: 100%;
  }

  .datetime-jump-wrap input[type="datetime-local"] {
    min-width: 0;
    width: 100%;
  }

  .search-wrap { width: 100%; }

  .search-wrap input {
    width: 100%;
    min-width: 0;
  }

  .controls .chk {
    width: auto;
    min-height: 40px;
    padding: 6px 4px;
  }

  .controls input[type="checkbox"] {
    width: 18px;
    height: 18px;
  }

  .ctrl-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    width: 100%;
  }

  .ctrl-actions .chk {
    margin-right: auto;
  }

  .ctrl-actions button,
  .ctrl-actions .nav-link {
    flex: 1 1 calc(50% - 8px);
    text-align: center;
  }

  .banner {
    padding: 10px 12px;
    word-break: break-word;
  }

  .meta {
    padding: 8px 12px;
    font-size: 12.5px;
    word-break: break-word;
  }

  .log-view {
    padding: 12px;
    font-size: 13.5px;
    line-height: 1.5;
    -webkit-overflow-scrolling: touch;
    overflow-x: auto;
  }

  footer {
    flex-direction: column;
    gap: 4px;
    padding: 8px 12px;
  }

  .foot-note { word-break: break-word; }
}

@media (max-width: 390px) {
  .brand h1 { font-size: 17px; }
  .logo { width: 48px; }

  .ctrl-actions button,
  .ctrl-actions .nav-link {
    flex: 1 1 100%;
  }
}
