:root {
  --bg: #0a0c0f;
  --panel: #12161b;
  --panel-2: #171c22;
  --line: #252c34;
  --muted: #84909d;
  --text: #edf3f7;
  --lime: #c9ff42;
  --lime-dark: #97c51f;
  --red: #ff655d;
  --amber: #ffbf47;
  --blue: #65a9ff;
  --radius: 18px;
  font-family: Inter, Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 72% -15%, rgba(201, 255, 66, 0.08), transparent 32rem),
    var(--bg);
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.boot-screen, .login-view {
  min-height: 100vh;
  display: grid;
  place-content: center;
  text-align: center;
}

.boot-screen { color: var(--muted); }
.boot-mark, .brand-mark {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 22px;
  border-radius: 22px;
  color: #11150a;
  background: var(--lime);
  box-shadow: 0 20px 55px rgba(201, 255, 66, 0.17);
  font-size: 26px;
  font-weight: 950;
  letter-spacing: -2px;
}

.login-card {
  width: min(460px, calc(100vw - 40px));
  padding: 48px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(18, 22, 27, 0.94);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.45);
}

.login-card h1 { margin: 9px 0 12px; font-size: 32px; letter-spacing: -1.3px; }
.login-copy, .config-help { color: var(--muted); line-height: 1.65; }
.login-button { margin-top: 24px; }
.config-help { margin: 18px 0 0; font-size: 13px; }
.notice { margin: 20px 0 0; padding: 12px; border-radius: 10px; color: #ffd4cf; background: rgba(255, 101, 93, 0.12); font-size: 14px; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  width: 252px;
  padding: 28px 20px 20px;
  border-right: 1px solid var(--line);
  background: rgba(12, 15, 18, 0.97);
}

.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px; }
.brand-mark.small { width: 40px; height: 40px; margin: 0; border-radius: 12px; font-size: 16px; box-shadow: none; }
.brand strong, .brand span { display: block; }
.brand span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.game-nav { flex: 1; margin-top: 48px; }
.nav-label, .eyebrow, .section-number { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: 1.7px; }
.nav-label { padding: 0 10px; }
.game-link { display: flex; align-items: center; gap: 12px; margin-top: 8px; padding: 12px; border-radius: 13px; color: var(--text); text-decoration: none; }
.game-link.active { background: var(--panel-2); box-shadow: inset 3px 0 var(--lime); }
.game-link.disabled { opacity: 0.35; }
.game-link strong, .game-link small { display: block; }
.game-link strong { font-size: 14px; }
.game-link small { margin-top: 4px; color: var(--muted); font-size: 11px; }
.moai-glyph, .plus-glyph { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: #262d26; color: var(--lime); font-weight: 900; }
.plus-glyph { color: var(--muted); background: #20252b; }

.sidebar-user { display: flex; align-items: center; gap: 10px; padding: 15px 8px 4px; border-top: 1px solid var(--line); }
.avatar { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 50%; color: #111; background: var(--lime); font-weight: 900; }
.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { font-size: 11px; }
.user-meta span { margin-top: 3px; color: var(--muted); font-size: 10px; text-transform: uppercase; }
.icon-button { border: 0; color: var(--muted); background: transparent; cursor: pointer; }

.workspace { margin-left: 252px; padding: 36px clamp(26px, 4vw, 64px) 64px; }
.topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; }
.topbar h1 { margin: 7px 0 0; font-size: 30px; letter-spacing: -1.2px; }
.topbar .eyebrow { margin: 0; color: var(--lime); }
.environment-picker { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }

select, input, textarea {
  width: 100%;
  border: 1px solid #303841;
  border-radius: 11px;
  outline: none;
  color: var(--text);
  background: #0d1115;
  transition: border-color 120ms, box-shadow 120ms;
}
select, input { height: 44px; padding: 0 13px; }
textarea { padding: 13px; resize: vertical; line-height: 1.55; }
select:focus, input:focus, textarea:focus { border-color: var(--lime-dark); box-shadow: 0 0 0 3px rgba(201, 255, 66, 0.08); }
.environment-picker select { width: 156px; }

.production-banner { display: flex; gap: 12px; margin-top: 24px; padding: 14px 18px; border: 1px solid rgba(255, 101, 93, 0.35); border-radius: 12px; color: #ffd3d0; background: rgba(255, 101, 93, 0.09); font-size: 13px; }
.production-banner strong { color: var(--red); }

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 28px 0 18px; }
.stat-card { padding: 17px 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); }
.stat-card span, .stat-card strong { display: block; }
.stat-card span { color: var(--muted); font-size: 11px; }
.stat-card strong { margin-top: 8px; font-size: 16px; }
.stat-card.accent { border-color: rgba(201, 255, 66, 0.25); background: linear-gradient(120deg, rgba(201, 255, 66, 0.1), var(--panel)); }
.stat-card.accent b { color: var(--lime); font-size: 22px; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, 0.85fr); gap: 18px; }
.side-stack { display: flex; flex-direction: column; gap: 18px; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.15); }
.compose-panel, .preview-panel, .test-panel, .history-panel { padding: 24px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.panel-heading.compact { margin-bottom: 16px; }
.panel-heading h2 { margin: 3px 0 0; font-size: 18px; letter-spacing: -0.4px; }
.section-number { margin: 0; color: var(--lime); }
.status-chip, .recommended-chip, .server-badge { padding: 5px 8px; border-radius: 7px; color: var(--muted); background: #20262c; font-size: 10px; }
.recommended-chip, .server-badge { color: var(--lime); background: rgba(201, 255, 66, 0.1); }

.field-row { display: grid; gap: 14px; }
.field-row.two { grid-template-columns: 1fr 1fr; }
.field { display: block; margin-top: 15px; }
.field > span { display: flex; justify-content: space-between; margin-bottom: 8px; color: #b8c0c8; font-size: 11px; font-weight: 650; }
.field > span b, .field > span i { color: var(--muted); font-size: 10px; font-style: normal; font-weight: 500; }
.compact-field { max-width: 310px; }
.localization-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 20px; }
.localization-heading strong, .localization-heading span:not(.server-badge) { display: block; }
.localization-heading strong { font-size: 13px; }
.localization-heading span:not(.server-badge) { margin-top: 4px; color: var(--muted); font-size: 10px; }
.locale-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; margin-top: 12px; }
.locale-card { min-width: 0; padding: 15px; border: 1px solid #2b343c; border-radius: 13px; background: #0e1216; }
.locale-card .field { margin-top: 12px; }
.locale-card textarea { min-height: 112px; }
.locale-card-heading { display: flex; align-items: center; justify-content: space-between; padding-bottom: 9px; border-bottom: 1px solid #222a31; }
.locale-card-heading strong { font-size: 12px; }
.locale-card-heading code { color: var(--lime); font-size: 9px; letter-spacing: 1px; }
.reward-box { margin-top: 18px; padding: 17px; border: 1px solid #303941; border-radius: 13px; background: #0f1317; }
.reward-heading { display: flex; align-items: center; justify-content: space-between; }
.reward-heading strong, .reward-heading span { display: block; }
.reward-heading strong { font-size: 13px; }
.reward-heading span:not(.server-badge) { margin-top: 4px; color: var(--muted); font-size: 10px; }

.form-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--line); }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 0 16px; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 750; text-decoration: none; cursor: pointer; }
.button:disabled { opacity: 0.35; cursor: not-allowed; }
.button.primary { color: #11150a; background: var(--lime); }
.button.primary:hover:not(:disabled) { background: #dcff82; }
.button.secondary { border-color: #333c45; color: var(--text); background: #1a2026; }
.button.ghost { min-height: 34px; color: var(--muted); background: transparent; }
.button.danger { color: white; background: #d94e48; }
.button.full { width: 100%; margin-top: 14px; }

.preview-language { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 9px; }
.preview-language select { width: 108px; height: 32px; padding: 0 9px; font-size: 10px; }
.mail-preview { min-height: 218px; padding: 18px; border-radius: 14px; background: linear-gradient(145deg, #1d2630, #13181e); box-shadow: inset 0 0 0 1px #2b3540; }
.preview-topline { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.preview-topline span { color: var(--lime); font-weight: 800; }
.mail-preview h3 { margin: 22px 0 10px; font-size: 17px; overflow-wrap: anywhere; }
.mail-preview p { min-height: 60px; margin: 0; color: #aab5bf; font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-rewards { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.preview-reward-chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 7px; color: #dfffa1; background: rgba(201, 255, 66, 0.1); font-size: 10px; }
.preview-reward-chip b { font-size: 11px; }
.preview-moai-icon { position: relative; display: inline-block; width: 13px; height: 17px; border: 1px solid #17140f; background: linear-gradient(90deg, #aa9569 0 64%, #6f5b3c 65%); clip-path: polygon(22% 0, 78% 5%, 92% 87%, 55% 100%, 5% 88%, 10% 18%); }
.preview-moai-icon::before { content: ""; position: absolute; left: 2px; top: 5px; width: 7px; height: 2px; border-top: 2px solid #17140f; border-bottom: 2px solid #17140f; }
.preview-dates { margin: 16px 0 0; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, 0.07); }
.preview-dates div { display: flex; justify-content: space-between; gap: 12px; margin-top: 5px; font-size: 9px; }
.preview-dates dt { color: #74808b; }
.preview-dates dd { margin: 0; color: #b8c2cb; text-align: right; }
.test-panel > p { margin: -4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.6; }

.history-panel { margin-top: 18px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 11px; }
th { padding: 11px 12px; border-bottom: 1px solid var(--line); color: var(--muted); text-align: left; font-weight: 600; white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid #1e242a; color: #bdc6ce; }
td strong { color: var(--text); }
.empty-cell { padding: 32px; color: var(--muted); text-align: center; }
.test-tag { margin-left: 6px; padding: 3px 5px; border-radius: 4px; color: var(--amber); background: rgba(255, 191, 71, 0.1); font-size: 9px; }

.send-dialog { width: min(480px, calc(100vw - 32px)); padding: 0; border: 1px solid #343c45; border-radius: 20px; color: var(--text); background: #151a20; box-shadow: 0 40px 120px black; }
.send-dialog::backdrop { background: rgba(0, 0, 0, 0.75); backdrop-filter: blur(6px); }
.send-dialog form { padding: 30px; }
.dialog-icon { display: grid; place-items: center; width: 42px; height: 42px; margin-bottom: 20px; border-radius: 50%; color: var(--red); background: rgba(255, 101, 93, 0.12); font-weight: 900; }
.send-dialog h2 { margin: 6px 0 8px; }
.send-dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.55; }
.confirmation-field { margin-top: 20px; padding: 14px; border-radius: 12px; background: #0d1115; }
.confirmation-field code { display: block; margin: 8px 0 10px; color: var(--red); font-size: 13px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 25px; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 20; max-width: 420px; padding: 14px 17px; border: 1px solid #36404a; border-radius: 11px; color: var(--text); background: #1a2026; box-shadow: 0 18px 60px black; font-size: 12px; }
.toast.error { border-color: rgba(255, 101, 93, 0.5); color: #ffd1ce; }
.toast.success { border-color: rgba(201, 255, 66, 0.4); color: #e6ffad; }

@media (max-width: 980px) {
  .sidebar { position: static; width: auto; height: auto; flex-direction: row; align-items: center; padding: 15px 20px; border-right: 0; border-bottom: 1px solid var(--line); }
  .game-nav { flex: 1; margin: 0 0 0 30px; }
  .nav-label, .game-link.disabled, .game-link small { display: none; }
  .game-link { display: inline-flex; margin: 0; }
  .sidebar-user { width: 220px; padding: 0; border: 0; }
  .workspace { margin-left: 0; padding-top: 25px; }
  .content-grid { grid-template-columns: 1fr; }
  .side-stack { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .sidebar .brand > div:last-child, .user-meta { display: none; }
  .game-nav { margin-left: 10px; }
  .sidebar-user { width: auto; margin-left: auto; }
  .workspace { padding: 22px 14px 44px; }
  .topbar { align-items: flex-start; }
  .environment-picker { display: block; }
  .environment-picker span { display: block; margin-bottom: 6px; }
  .environment-picker select { width: 130px; }
  .stats-row { grid-template-columns: 1fr; }
  .stat-card { display: flex; align-items: center; justify-content: space-between; }
  .stat-card strong { margin: 0; }
  .field-row.two, .side-stack { grid-template-columns: 1fr; }
  .locale-grid { grid-template-columns: 1fr; }
  .compose-panel, .preview-panel, .test-panel, .history-panel { padding: 18px; }
  .form-actions { flex-direction: column; }
  .form-actions .button { width: 100%; }
  .production-banner { flex-direction: column; }
}
