:root {
  --bg: #16161a; --panel: #1f1f26; --line: #f2c94c; --text: #f4f4f5; --muted: #a0a0ab; --bad: #ff7b72;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font-family: "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", system-ui, sans-serif;
  overflow: hidden; overscroll-behavior: none; -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.hidden { display: none !important; }
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; overflow-y: auto; }
#screen-game { padding: 0; display: block; overflow: hidden; }
#game-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: pointer; }

.panel {
  width: min(360px, 100%); background: var(--panel); border: 3px solid var(--line);
  padding: 22px 20px; display: flex; flex-direction: column; gap: 10px; margin: auto;
}
.panel.wide { width: min(560px, 100%); }
h1, h2 { margin: 0; text-align: center; color: var(--line); letter-spacing: 1px; }
h1 { font-size: 28px; } h2 { font-size: 22px; }
.sub { margin: 0 0 6px; text-align: center; color: var(--muted); font-size: 13px; line-height: 1.5; }
.note { margin: 0; font-size: 12.5px; line-height: 1.5; color: var(--line); }
.msg { margin: 0; min-height: 18px; font-size: 13px; line-height: 1.5; color: var(--bad); user-select: text; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
input[type=text], input[type=password] {
  font: inherit; font-size: 16px; padding: 10px; color: var(--text); background: #14141a;
  border: 2px solid #444450; border-radius: 0; -webkit-user-select: text; user-select: text;
}
input:focus { outline: none; border-color: var(--line); }

.btn {
  font: inherit; font-size: 15px; font-weight: bold; padding: 11px 14px; color: var(--text);
  background: #2a2a33; border: 2px solid #55555f; cursor: pointer; border-radius: 0; touch-action: manipulation;
}
.btn:hover:not(:disabled) { border-color: var(--line); }
.btn.primary { background: var(--line); color: #1a1a1a; border-color: var(--line); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.hud {
  position: absolute; top: max(10px, env(safe-area-inset-top)); left: 10px; padding: 5px 10px; font-size: 12px;
  background: rgba(15, 15, 20, .8); border: 2px solid var(--line); pointer-events: none;
}
.menu { position: absolute; top: max(10px, env(safe-area-inset-top)); right: 10px; display: flex; gap: 6px; }
.menu .btn { background: rgba(15, 15, 20, .85); border-color: var(--line); }
.overlay {
  position: absolute; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; padding: 16px;
}
.overlay p { margin: 0 0 8px; text-align: center; line-height: 1.6; }

.custom-grid { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; align-items: flex-start; }
#preview { background: #6f6f73; border: 2px solid #444450; width: 180px; height: 260px; }
#slots { flex: 1; min-width: 220px; display: flex; flex-direction: column; gap: 10px; }
.slot { display: flex; align-items: center; gap: 8px; padding: 8px; background: #14141a; border: 2px solid #33333c; flex-wrap: wrap; }
.slot .name { width: 40px; font-weight: bold; color: var(--line); }
.slot .state { flex: 1; font-size: 12px; color: var(--muted); min-width: 70px; }
.slot img { width: 36px; height: 36px; object-fit: contain; background: #6f6f73; image-rendering: auto; }
.file-btn input { display: none; }
.file-btn { display: inline-block; }
