*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body {
  background: #0f0f1a;
  font-family: 'Noto Sans JP', sans-serif;
  overflow: hidden;
  position: fixed;
  inset: 0;
}

#app {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  position: relative;
}

.bg {
  position: fixed;
  inset: 0;
  opacity: .05;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 15% 50%, #e83c6a 0%, transparent 45%),
    radial-gradient(circle at 85% 20%, #3c7be8 0%, transparent 45%),
    radial-gradient(circle at 50% 85%, #e8c83c 0%, transparent 45%);
}

h1 {
  color: #eee;
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2px;
  text-shadow: 0 0 30px rgba(232, 60, 106, .25);
}

.sub {
  color: #666;
  font-size: 11px;
  margin-top: 4px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.stats {
  display: flex;
  gap: 20px;
  justify-content: center;
  margin-top: 10px;
  color: #888;
  font-size: 12px;
}

.stats b  { color: #fff; }
.stats .sc  { color: #8ce99a; }
.stats .str { color: #ffa94d; }

.board {
  position: relative;
  z-index: 1;
}

.labels {
  display: grid;
  grid-template-columns: 62px 18px 62px 18px 86px;
  align-items: center;
  margin-bottom: 8px;
}

.board.fast .labels,
.board.fast .row {
  grid-template-columns: 62px 18px 62px;
}

.lbl {
  color: #555;
  font-size: 9px;
  text-align: center;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.grid {
  transition: all .4s ease;
}

.grid.out {
  opacity: 0;
  transform: scale(.95);
}

.row {
  display: grid;
  grid-template-columns: 62px 18px 62px 18px 86px;
  align-items: center;
  margin-bottom: 10px;
}

.divider {
  display: flex;
  justify-content: center;
}

.divider i {
  width: 1px;
  height: 40px;
  background: rgba(255, 255, 255, .06);
}

.cell {
  display: flex;
  justify-content: center;
}

button.tile {
  width: 60px;
  height: 60px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: rgba(255, 255, 255, .06);
  color: #ccc;
  font-size: 28px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Noto Sans JP', sans-serif;
}

button.tile.sel {
  background: #3c7be8;
  color: #fff;
  border-color: #74c0fc;
  transform: scale(1.06);
  box-shadow: 0 0 16px rgba(60, 123, 232, .35);
}

button.tile.matched {
  opacity: .55;
  cursor: default;
}

button.tile.wrong-h { border-color: #ff6b6b; transform: translateX(-3px); }
button.tile.wrong-k { border-color: #ff6b6b; transform: translateX(3px); }

.romaji-done {
  width: 82px;
  height: 40px;
  border-radius: 8px;
  opacity: .55;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 15px;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  letter-spacing: 1px;
}

input.romaji {
  width: 82px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .04);
  color: #eee;
  font-size: 15px;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  text-align: center;
  letter-spacing: 1px;
  outline: none;
  transition: all .2s;
  border: 2px solid rgba(255, 255, 255, .1);
}

input.romaji:focus {
  border-color: rgba(255, 255, 255, .3) !important;
  background: rgba(255, 255, 255, .07) !important;
}

input.romaji::placeholder { color: rgba(255, 255, 255, .15); }

input.romaji.wrong {
  border-color: #ff6b6b !important;
  background: rgba(255, 107, 107, .1) !important;
  animation: shake .4s ease;
}

.blank {
  width: 82px;
  height: 40px;
  border-radius: 8px;
  background: rgba(255, 255, 255, .02);
  border: 2px dashed rgba(255, 255, 255, .06);
}

.hint {
  color: #555;
  font-size: 11px;
  margin-top: 20px;
  text-align: center;
  letter-spacing: .4px;
  line-height: 1.7;
  position: relative;
  z-index: 1;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 15, 26, .75);
  animation: fadeIn .3s ease;
}

.overlay.no-anim              { animation: none; }
.overlay.no-anim .inner       { animation: none; }

.overlay .inner {
  text-align: center;
  animation: popIn .4s cubic-bezier(.34, 1.56, .64, 1);
}

.overlay .emoji { font-size: 52px; margin-bottom: 8px; }

.overlay .title {
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  letter-spacing: 3px;
  text-shadow: 0 0 30px rgba(218, 119, 242, .5);
}

.overlay .desc {
  color: #aaa;
  font-size: 13px;
  margin-top: 6px;
  letter-spacing: 1px;
}

.surrender-pair {
  display: flex;
  gap: 24px;
  justify-content: center;
  margin-bottom: 16px;
}

.surrender-char {
  font-size: 64px;
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 30px rgba(116, 192, 252, .4);
}

.surrender-romaji {
  font-size: 28px;
  font-family: 'DM Mono', monospace;
  font-weight: 500;
  color: #74c0fc;
  letter-spacing: 3px;
}

.settings-panel {
  background: #1a1a2e;
  border-radius: 20px;
  padding: 28px 32px;
  min-width: 280px;
  text-align: left;
}

.settings-title {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  margin-bottom: 24px;
  text-align: center;
}

.settings-label {
  color: #555;
  font-size: 9px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.opt-row {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.opt-btn {
  flex: 1;
  padding: 10px 0;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .05);
  color: #666;
  font-size: 18px;
  cursor: pointer;
  font-family: 'Noto Sans JP', sans-serif;
  transition: all .2s;
  text-align: center;
}

.opt-btn.opt-active {
  background: #3c7be8;
  border-color: #74c0fc;
  color: #fff;
}

.settings-done {
  width: 100%;
  padding: 10px 0;
  border-radius: 10px;
  border: none;
  background: rgba(255, 255, 255, .08);
  color: #aaa;
  font-size: 13px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  font-family: 'DM Mono', monospace;
  transition: all .2s;
}

.gear-btn {
  position: absolute;
  left: 16px;
  top: 16px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  z-index: 5;
  opacity: .4;
  transition: opacity .2s;
}

.gear-btn:hover { opacity: .8; }

.gear-btn img {
  width: 22px;
  height: 22px;
  display: block;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-4px); }
  75%       { transform: translateX(4px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: scale(.5); }
  to   { opacity: 1; transform: scale(1); }
}
