* { margin:0; padding:0; box-sizing:border-box; -webkit-tap-highlight-color:transparent; }
html, body { height:100%; }
body {
  font-family: -apple-system, 'Segoe UI', Roboto, sans-serif;
  background:#0d2818; color:#e8f5e9; overflow:hidden;
  user-select:none; -webkit-user-select:none;
}
.view { display:none; height:100dvh; flex-direction:column; }
.view.active { display:flex; }
.view.dark { background:#101014; }

/* ---------- Game ---------- */
.game-header { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; }
.game-title { font-size:22px; font-weight:800; }
.icon-btn {
  background:rgba(255,255,255,.12); border:none; color:#fff; font-size:20px;
  width:42px; height:42px; border-radius:12px; cursor:pointer;
  display:flex; align-items:center; justify-content:center;
}
.score-bar { display:flex; justify-content:space-around; padding:6px; font-size:15px; color:#a5d6a7; }
.canvas-wrap { position:relative; margin:8px auto; width:min(92vw, 420px); aspect-ratio:1; }
#game { width:100%; height:100%; background:#071a10; border-radius:16px; border:2px solid #1b5e20; touch-action:none; }
.game-overlay {
  position:absolute; inset:0; display:flex; flex-direction:column; gap:14px;
  align-items:center; justify-content:center; background:rgba(0,0,0,.55); border-radius:16px;
}
.game-overlay.hidden { display:none; }
#overlay-text { font-size:28px; font-weight:800; }
.btn {
  background:#2e7d32; color:#fff; border:none; padding:12px 28px; font-size:17px;
  border-radius:14px; cursor:pointer; font-weight:700;
}
.btn.danger { background:#c62828; }
.dpad { display:grid; grid-template-columns:repeat(3, 64px); gap:6px; justify-content:center; margin:10px auto; }
.dpad button {
  width:64px; height:56px; font-size:20px; border-radius:12px; border:none;
  background:rgba(255,255,255,.14); color:#fff; cursor:pointer;
}
.hint { text-align:center; color:#81c784; font-size:13px; padding-bottom:16px; }

/* ---------- Settings ---------- */
.settings-list { padding:20px; display:flex; flex-direction:column; gap:10px; }
.settings-label { color:#81c784; font-size:14px; font-weight:700; margin-top:6px; }
.diff-btn {
  background:rgba(255,255,255,.08); color:#fff; border:2px solid transparent;
  padding:16px; font-size:18px; border-radius:14px; cursor:pointer; text-align:left;
}
.diff-btn.selected { border-color:#4caf50; background:rgba(76,175,80,.15); }
.about-text { color:#777; font-size:14px; line-height:1.7; }

/* ---------- Hidden login (no labels by design) ---------- */
#view-login { align-items:center; justify-content:center; background:#000; }
.login-box { display:flex; flex-direction:column; gap:18px; width:78%; max-width:320px; }
.login-box input {
  background:#16161c; border:1px solid #2a2a33; color:#fff; font-size:20px;
  padding:16px; border-radius:12px; outline:none; text-align:center; letter-spacing:2px;
}
.login-box input:focus { border-color:#444; }
.login-err { color:#e57373; font-size:13px; text-align:center; min-height:18px; }

/* ---------- Vault ---------- */
.vault-header { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; }
.vault-title { font-size:20px; font-weight:800; }
#view-vault .icon-btn, #view-gallery .icon-btn, #view-notes .icon-btn, #view-editor .icon-btn { background:rgba(255,255,255,.08); }
.vault-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; padding:24px; }
.vault-tile {
  background:#1a1a22; border:1px solid #2a2a35; color:#fff; border-radius:20px;
  padding:36px 12px; font-size:44px; cursor:pointer; display:flex; flex-direction:column; gap:10px; align-items:center;
}
.vault-tile span { font-size:16px; font-weight:600; }
.file-label { cursor:pointer; }

/* ---------- Gallery ---------- */
.gallery-grid { display:grid; grid-template-columns:repeat(3, 1fr); gap:6px; padding:10px; overflow-y:auto; }
.g-item { position:relative; aspect-ratio:1; border-radius:10px; overflow:hidden; background:#1a1a22; cursor:pointer; }
.g-item img, .g-item video { width:100%; height:100%; object-fit:cover; }
.g-item .v-badge {
  position:absolute; bottom:6px; right:6px; background:rgba(0,0,0,.6);
  font-size:11px; padding:2px 7px; border-radius:8px;
}
.empty-msg { text-align:center; color:#666; margin:auto; line-height:2; font-size:15px; }
.media-viewer {
  position:fixed; inset:0; background:#000; z-index:50; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:16px; padding:20px;
}
.media-viewer.hidden { display:none; }
.media-viewer img, .media-viewer video { max-width:100%; max-height:70vh; border-radius:12px; }
.viewer-close { position:absolute; top:14px; right:14px; }
.upload-progress { position:fixed; bottom:30px; left:10%; right:10%; height:8px; background:#222; border-radius:6px; z-index:60; overflow:hidden; }
.upload-progress.hidden { display:none; }
#upload-bar { height:100%; width:0%; background:#4caf50; border-radius:6px; transition:width .2s; }

/* ---------- Notes ---------- */
.notes-list { overflow-y:auto; padding:10px; display:flex; flex-direction:column; gap:8px; }
.note-card { background:#1a1a22; border:1px solid #2a2a35; border-radius:14px; padding:14px; cursor:pointer; text-align:left; color:#fff; width:100%; }
.note-card h4 { font-size:16px; margin-bottom:4px; }
.note-card p { font-size:13px; color:#999; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.note-card small { color:#555; font-size:11px; }
.note-title-input, .note-body-input {
  background:transparent; border:none; color:#fff; outline:none; padding:14px 18px; width:100%;
}
.note-title-input { font-size:20px; font-weight:700; }
.note-body-input { flex:1; font-size:16px; resize:none; line-height:1.6; }
#view-editor .btn.danger { margin:0 18px 22px; }
#view-editor .btn.danger.hidden { display:none; }

/* ---------- Toast ---------- */
.toast {
  position:fixed; bottom:40px; left:50%; transform:translateX(-50%);
  background:#222; color:#fff; padding:12px 22px; border-radius:24px; font-size:14px; z-index:100;
}
.toast.hidden { display:none; }
