/* Variables and base */
:root {
  --bg: #0f1115;
  --panel: #171a21;
  --muted: #8c96a4;
  --text: #e8eef9;
  --accent: #2ED8EE;
  --accent-2: #63E2FF;
  --radius: 8px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font-family: Arial, sans-serif; font-size: 14px; display: flex; flex-direction: column; min-height: 100vh; }

/* Header (if used) */
header { position: sticky; top: 0; z-index: 5; background: rgba(15,17,21,.8); backdrop-filter: blur(10px); border-bottom: 1px solid #1f2430; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 16px; }
h1 { font-size: 22px; margin: 0 0 8px; letter-spacing: .3px; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 12px; }

/* Toolbar (if used) */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; justify-content: space-between; }
.left, .right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Buttons */
.btn { --btn-bg: #202534; --btn-bd: #2a3143; --btn-tx: var(--text); appearance: none; border: 1px solid var(--btn-bd); background: var(--btn-bg); color: var(--btn-tx); padding: 8px 12px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 13px; transition: transform .08s ease, background .2s, border-color .2s, box-shadow .2s; }
.btn:hover { border-color: #3a455e; box-shadow: 0 0 0 3px rgba(46,216,238,.1); }
.btn:active { transform: translateY(1px); }
.btn.accent { --btn-bg: linear-gradient(90deg, var(--accent), var(--accent-2)); --btn-bd: transparent; color: #0b0d12; }
.btn.ghost { background: transparent; border-color: #2a3143; color: var(--muted); }

/* Search (if used) */
.search { display: flex; align-items: center; gap: 8px; background: #12161e; border: 1px solid #273042; border-radius: 10px; padding: 6px 10px; flex: 1 1 280px; min-width: 240px; }
.search input { flex: 1; background: transparent; border: 0; color: var(--text); outline: none; font-size: 14px; }

/* Grid fills available viewport space */
.grid { width: 100%; margin: 0; padding: 16px; flex: 1 1 auto; min-height: 0; }
#grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; align-content: start; }

/* Tile with sub-buttons */
.tile { display: flex; flex-direction: column; gap: 8px; }

/* Top language menu (full width, sticky) */
.lang-menu { width: 100%; margin: 0; padding: 12px 16px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: sticky; top: 0; z-index: 5; background: rgba(15,17,21,.85); backdrop-filter: blur(6px); border-bottom: 1px solid #1f2430; }
.lang-chip { padding: 4px 10px; font-size: 12px; }
.lang-chip.active { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 3px rgba(46,216,238,.08); }

/* Rows (optional older layout) */
.row { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center; background: var(--panel); border: 1px solid #222838; padding: 8px; border-radius: var(--radius); }
.label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.field { display: flex; flex-direction: column; }

/* Inputs */
input.phrase, .phrase-header { font-size: 13px; padding: 6px; }
input.phrase { border-radius: var(--radius); border: 1px solid #2a3143; background: #0f1420; color: var(--text); }

/* Actions */
.actions { display: flex; gap: 4px; }
button.btn { font-size: 12px; padding: 4px 8px; border-radius: var(--radius); }

/* Chips and switches (optional) */
.chip { font-size: 11px; color: var(--muted); border: 1px dashed #2b3345; padding: 6px 8px; border-radius: 999px; }
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.switch input { appearance: none; width: 36px; height: 20px; background: #263047; border-radius: 999px; position: relative; outline: none; cursor: pointer; border: 1px solid #2d3854; }
.switch input:checked { background: #254a5d; border-color: #2ED8EE; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #c7d2e5; transition: transform .2s; }
.switch input:checked::after { transform: translateX(16px); background: #eaf8ff; }

/* Dialog */
dialog { width: min(900px, 92vw); border: 1px solid #263047; background: #0f1420; color: var(--text); border-radius: 14px; padding: 0; overflow: hidden; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid #1e2736; background: #0c1018; }
.dlg-body { padding: 16px; }
.dlg-form { min-width: 320px; max-width: 98vw; padding: 16px; }
.dlg-group { margin-bottom: 12px; }
.dlg-group + .dlg-group { margin-bottom: 18px; }
.dlg-input { width: 100%; font-size: 1.1em; padding: 8px; margin-top: 2px; border-radius: 10px; border: 1px solid #273042; background: #0b0f16; color: #cfe3ff; }
.dlg-actions { display: flex; gap: 10px; justify-content: flex-end; }

textarea.json { width: 100%; min-height: 360px; background: #0b0f16; color: #cfe3ff; border: 1px solid #273042; border-radius: 10px; padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace; font-size: 13px; }

/* Toast */
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: #0b111a; border: 1px solid #223149; padding: 10px 14px; border-radius: 10px; color: var(--text); box-shadow: 0 10px 30px rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(-4px); }

.count { font-size: 12px; color: var(--muted); }

/* Big buttons */
.big-btn { font-size: 1.25rem; padding: 28px 16px; min-height: 96px; white-space: normal; word-break: break-word; border-radius: 18px; font-weight: 700; box-shadow: 0 2px 12px 0 rgba(0,0,0,0.10); }
@media (max-width: 600px) { .big-btn { font-size: 1rem; padding: 20px 8px; min-height: 56px; } }
.add-btn { background: #1a2a2a; color: #2ED8EE; border: 2px dashed #2ED8EE; font-size: 2em; display: flex; align-items: center; justify-content: center; }
.add-btn:hover { background: #223a3a; color: #fff; }

/* SVG sample */
svg { width: 200px; height: 200px; }
.hole { fill: white; stroke: black; stroke-width: 0.25; }

/* Responsive tweak for legacy .row */
@media (max-width: 800px) { .row { grid-template-columns: 1fr; } }

/* Utilities */
.hidden { display: none !important; }
