* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic UI", sans-serif;
  font-weight: 700;
  background: #111318;
  color: #f2f4f8;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.bar {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 2px solid #262b36;
}

.bar h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0.08em;
}

.bar button {
  font: inherit;
  font-size: 18px;
  font-weight: 700;
  color: #f2f4f8;
  background: #2b3140;
  border: none;
  border-radius: 12px;
  padding: 10px 20px;
  cursor: pointer;
}

.bar button:active { background: #3a4256; }

.tiles {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: none;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
  padding: 14px;
}

.tile {
  font: inherit;
  font-weight: 700;
  font-size: 26px;
  line-height: 1.35;
  color: #fff;
  background: #2f3646;
  border: none;
  border-radius: 20px;
  min-height: 120px;
  padding: 18px 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  word-break: auto-phrase;
  transition: transform 0.08s ease, filter 0.08s ease;
}

.tile:active { transform: scale(0.97); filter: brightness(1.25); }

.tile.speaking {
  outline: 4px solid #ffd54a;
  outline-offset: -4px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  max-width: 90vw;
  background: #3a2020;
  color: #ffdede;
  font-size: 16px;
  padding: 12px 18px;
  border-radius: 12px;
}
