:root { color-scheme: dark; }

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  padding: 1rem;
  font-family: system-ui, sans-serif;
  background: #111;
  color: #eee;
  line-height: 1.5;
}

body.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1rem;
}

h1 { font-size: 1.6rem; margin: 0; }
h2 { font-size: 1.3rem; margin: 0 0 .5rem; }

.card {
  max-width: 30rem;
  margin: 0 auto;
  padding: 1.25rem;
  background: #1b1b1f;
  border: 1px solid #2c2c34;
  border-radius: 1rem;
}

.lobby {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  width: min(20rem, 100%);
}

label { display: flex; flex-direction: column; gap: .4rem; text-align: left; }

input {
  font-size: 1.5rem;
  padding: .75rem;
  border: 1px solid #3a3a44;
  border-radius: .6rem;
  background: #15151a;
  color: #eee;
  text-align: center;
  letter-spacing: .15em;
}

button {
  font-size: 1.15rem;
  padding: .9rem 1.5rem;
  border: none;
  border-radius: .6rem;
  background: #2d6cdf;
  color: #fff;
}
button:disabled { opacity: .5; }

.muted { color: #9a9aa6; }
.ok { color: #4ade80; }
.wait { color: #fbbf24; }
.error { color: #f87171; }
.hint { color: #9a9aa6; font-size: .9rem; }

/* Permissions page */
.perms { max-width: 32rem; margin: 0 auto; }
.perm { border: 1px solid #2c2c34; border-radius: .6rem; padding: 1rem; margin: 1rem 0; }
.perm-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.perm-head h2 { font-size: 1.15rem; }
.badge { font-size: .8rem; padding: .2rem .6rem; border-radius: .4rem; background: #2c2c34; color: #9a9aa6; white-space: nowrap; }
.badge-granted { background: #14532d; color: #4ade80; }
.badge-denied { background: #4c1d1d; color: #f87171; }
.badge-notset { background: #3a3a1a; color: #fbbf24; }
.denied-help { font-size: .9rem; color: #f87171; margin-top: .5rem; }

/* Mastermind */
.entry { display: flex; gap: .5rem; justify-content: center; margin: 1rem 0; }
.slot {
  width: 2.6rem; height: 3.2rem;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; font-weight: 600;
  border: 2px solid #3a3a44; border-radius: .5rem; background: #15151a;
}
.keypad {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem;
  max-width: 17rem; margin: 0 auto;
}
.key { font-size: 1.4rem; padding: .9rem 0; }
.key.alt { background: #3a3a44; }
.key.go { grid-column: 1 / -1; background: #16a34a; font-size: 1.2rem; }
.history { margin-top: 1.25rem; }
.guess { display: flex; gap: .4rem; justify-content: center; margin: .35rem 0; }
.cell {
  width: 2.1rem; height: 2.1rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: .4rem; font-weight: 700;
}
.cell.exact { background: #16a34a; color: #fff; }
.cell.present { background: #ca8a04; color: #fff; }
.cell.absent { background: #2c2c34; color: #9a9aa6; }
.bigcode { font-size: 2.6rem; letter-spacing: .3em; font-weight: 800; margin: .5rem 0; }

/* Bomb */
.bomb-status {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem; padding: .5rem .75rem;
  background: #15151a; border: 1px solid #2c2c34; border-radius: .5rem;
}
.timer { font-size: 2rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.timer.danger { color: #f87171; }
.strikes { display: flex; gap: .25rem; }
.strike { color: #444; font-weight: 800; }
.strike.on { color: #ef4444; }

.edge { margin-bottom: 1rem; text-align: left; }
.edge summary { cursor: pointer; color: #fbbf24; }
.edge ul { margin: .5rem 0; padding-left: 1.1rem; }
.ind { padding: .05rem .35rem; border-radius: .3rem; background: #2c2c34; color: #777; font-size: .85rem; }
.ind.lit { background: #facc15; color: #111; }

.module { margin-top: 1rem; padding: .75rem; border: 1px solid #2c2c34; border-radius: .6rem; text-align: left; }
.modhead { display: flex; align-items: center; gap: .5rem; font-weight: 600; margin-bottom: .5rem; }
.light { width: .9rem; height: .9rem; border-radius: 50%; background: #ef4444; flex: none; }
.light.green { background: #22c55e; }

.wires { display: flex; flex-direction: column; gap: .55rem; }
.wirerow { display: flex; align-items: center; gap: .75rem; }
.wire { width: 3rem; height: .8rem; border-radius: .4rem; flex: none; }
.wire-red { background: #ef4444; }
.wire-blue { background: #3b82f6; }
.wire-yellow { background: #eab308; }
.wire-white { background: #f5f5f5; }
.wire-black { background: #000; border: 1px solid #555; }
.wirelabel { flex: 1; }
.cut { background: #b91c1c; padding: .5rem 1rem; font-size: 1rem; }

.manual { text-align: left; }
.manual ol { padding-left: 1.2rem; line-height: 1.7; }
.manual h3 { margin: .5rem 0; }

/* Voice bar */
#voicebar {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 1rem;
  background: #15151a; border-top: 1px solid #2c2c34;
}
#voice-btn { font-size: 1rem; padding: .6rem 1rem; background: #16a34a; }
#voice-btn.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, .6); }
  50% { box-shadow: 0 0 0 .55rem rgba(34, 197, 94, 0); }
}
body { padding-bottom: 4rem; }

.voicehint {
  background: #15240f; border: 1px solid #2f5e1f; color: #a3e635;
  padding: .5rem .75rem; border-radius: .5rem; margin: .5rem 0; font-size: .95rem;
}

/* The Button module */
.bigbutton {
  display: block; width: 8rem; height: 8rem; margin: 1rem auto;
  border-radius: 50%; border: 6px solid #888;
  font-size: 1.1rem; font-weight: 800; letter-spacing: .03em; color: #fff;
}
.btn-red { background: #b91c1c; }
.btn-blue { background: #1d4ed8; }
.btn-yellow { background: #ca8a04; color: #111; }
.btn-white { background: #e5e5e5; color: #111; }
.led-blue { border-color: #3b82f6; }
.led-yellow { border-color: #eab308; }
.led-white { border-color: #f5f5f5; }
.led-red { border-color: #ef4444; }

/* Expert manual tabs (CSS-only; survives Defuser actions) */
.tabs input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.tabbar { display: flex; flex-wrap: wrap; gap: .25rem; margin-bottom: -1px; }
.tabbar label {
  padding: .5rem .85rem; cursor: pointer;
  background: #15151a; color: #9a9aa6;
  border: 1px solid #2c2c34; border-bottom: none;
  border-radius: .5rem .5rem 0 0;
}
.panels { border: 1px solid #2c2c34; border-radius: 0 .5rem .5rem .5rem; padding: .75rem; }
.panel { display: none; }
#mtab-wires:checked ~ .panels .panel-wires,
#mtab-button:checked ~ .panels .panel-button,
#mtab-keypad:checked ~ .panels .panel-keypad,
#mtab-simon:checked ~ .panels .panel-simon { display: block; }
#mtab-wires:checked ~ .tabbar label[for="mtab-wires"],
#mtab-button:checked ~ .tabbar label[for="mtab-button"],
#mtab-keypad:checked ~ .tabbar label[for="mtab-keypad"],
#mtab-simon:checked ~ .tabbar label[for="mtab-simon"] {
  background: #2d6cdf; color: #fff; border-color: #2d6cdf;
}
.simontable { width: 100%; border-collapse: collapse; margin: .25rem 0 .75rem; }
.simontable th, .simontable td { border: 1px solid #2c2c34; padding: .35rem; text-align: center; }
.simontable th { background: #15151a; color: #9a9aa6; font-weight: 600; }

/* Intro / how-to text on the bomb cards */
.intro {
  background: #1b1b2e; border: 1px solid #33335a; border-radius: .5rem;
  padding: .6rem .8rem; margin: .5rem 0; font-size: .95rem;
}

/* Keypad (Symbols) */
.glyph { display: block; color: #e5e5e5; }
.keypad-keys {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .6rem;
  max-width: 15rem; margin: .5rem auto 0;
}
.symkey {
  aspect-ratio: 1; padding: .5rem; background: #15151a;
  border: 1px solid #3a3a44; border-radius: .6rem;
}
.symkey.done { background: #14532d; border-color: #16a34a; }
.symkey .glyph { width: 2.8rem; height: 2.8rem; margin: 0 auto; }
.symcols { display: grid; grid-template-columns: repeat(6, 1fr); gap: .35rem; margin-top: .5rem; }
.symcol {
  display: flex; flex-direction: column; align-items: center; gap: .3rem;
  padding: .3rem .15rem; background: #15151a; border-radius: .4rem;
}
.symcol .glyph { width: 1.5rem; height: 1.5rem; }

/* Simon Says */
.simon {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem;
  max-width: 12rem; margin: .5rem auto;
}
.simonbtn { aspect-ratio: 1; border: none; border-radius: .7rem; opacity: .5; transition: opacity .08s; }
.simonbtn.flash { opacity: 1; box-shadow: 0 0 1rem .15rem currentColor; }
.s-red { background: #ef4444; color: #ef4444; }
.s-blue { background: #3b82f6; color: #3b82f6; }
.s-green { background: #22c55e; color: #22c55e; }
.s-yellow { background: #eab308; color: #eab308; }

/* Password module */
.password { display: flex; justify-content: center; gap: .4rem; margin: .6rem 0; }
.pwcol { display: flex; flex-direction: column; align-items: center; gap: .25rem; }
.pwbtn {
  width: 2.6rem; padding: .25rem 0; font-size: 1rem; line-height: 1;
  background: #2c2c34; color: #cfcfd6; border: 1px solid #3a3a44; border-radius: .4rem;
}
.pwbtn:active { background: #3a3a44; }
.pwletter {
  width: 2.6rem; height: 2.8rem; display: flex; align-items: center; justify-content: center;
  font-size: 1.7rem; font-weight: 800; font-family: ui-monospace, monospace;
  background: #15151a; border: 1px solid #3a3a44; border-radius: .4rem;
}
.pwsubmit { display: block; margin: .3rem auto 0; }
.wordlist { display: grid; grid-template-columns: repeat(5, 1fr); gap: .3rem; margin-top: .4rem; }
.wordlist span {
  font-family: ui-monospace, monospace; text-transform: uppercase; text-align: center;
  padding: .2rem; background: #15151a; border-radius: .3rem; font-size: .85rem;
}

.hidden { display: none !important; }
.bignum { font-size: 2.6rem; font-weight: 800; text-align: center; margin: 1rem 0; }

/* Agree screen */
.agreeform { display: flex; flex-direction: column; gap: .75rem; max-width: 20rem; margin: 1rem auto; }
.agreeselect {
  font-size: 1.1rem; padding: .7rem; border-radius: .6rem;
  background: #15151a; color: #eee; border: 1px solid #3a3a44;
}
#nav-enable { font-size: 1.05rem; padding: .8rem 1.4rem; background: #2d6cdf; }
#cooldown-ok { font-size: 1.15rem; padding: .9rem 1.5rem; background: #2d6cdf; margin-top: .5rem; }
.simoninfo { text-align: center; margin: .25rem 0; min-height: 1.4em; }
.simon.shake { animation: shake .4s; border-radius: .7rem; outline: 2px solid #ef4444; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-7px); }
  40%, 80% { transform: translateX(7px); }
}
