:root {
  color-scheme: light;
  --ink: #25211d;
  --muted: #6f6b65;
  --paper: #f8f5ef;
  --surface: #fffdf8;
  --line: #ddd5ca;
  --accent: #35685f;
  --accent-dark: #244a44;
  --rose: #b0636a;
  --shadow: 0 18px 50px rgba(47, 42, 35, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Segoe UI", sans-serif;
  background:
    linear-gradient(135deg, rgba(53, 104, 95, 0.12), rgba(176, 99, 106, 0.08)),
    var(--paper);
}

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1160px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 34px 0 44px;
}

.site-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.kicker,
.login-kicker {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 5vw, 4.4rem);
  font-weight: 500;
  line-height: 0.95;
}

.logout {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 253, 248, 0.72);
}

.sound-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.sound-tile {
  position: relative;
  display: flex;
  min-height: 118px;
  flex-direction: column;
  justify-content: space-between;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-align: left;
  background: rgba(255, 253, 248, 0.84);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.sound-tile:hover:not(:disabled),
.sound-tile:focus-visible {
  border-color: rgba(53, 104, 95, 0.65);
  box-shadow: var(--shadow);
  transform: translateY(-2px);
  outline: none;
}

.sound-tile.is-playing {
  border-color: var(--accent);
  background: #f1faf6;
}

.sound-tile:disabled {
  color: #9b948a;
  cursor: default;
  background: rgba(255, 253, 248, 0.48);
}

.tile-number {
  color: var(--rose);
  font-size: 0.74rem;
  font-weight: 700;
}

.tile-title {
  display: block;
  overflow-wrap: anywhere;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
}

.tile-subtitle {
  display: block;
  min-height: 1.2em;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.25;
}

.loading {
  grid-column: 1 / -1;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  background: rgba(255, 253, 248, 0.78);
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(430px, 100%);
}

.login-panel {
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow);
}

.login-panel h1 {
  margin-bottom: 24px;
  font-size: clamp(2rem, 8vw, 3rem);
}

.login-panel form {
  display: grid;
  gap: 10px;
}

.login-panel label {
  color: var(--muted);
  font-size: 0.9rem;
}

.login-panel input {
  width: 100%;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

.login-panel button {
  height: 44px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--accent);
  cursor: pointer;
}

.login-panel button:hover {
  background: var(--accent-dark);
}

.error {
  min-height: 1.2em;
  margin: 14px 0 0;
  color: #a33a43;
}

@media (max-width: 820px) {
  .sound-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .sound-tile {
    min-height: 104px;
  }
}

@media (max-width: 520px) {
  .app-shell {
    width: min(100% - 20px, 1160px);
    padding-top: 22px;
  }

  .site-header {
    align-items: start;
  }

  .sound-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .sound-tile {
    min-height: 96px;
    padding: 12px;
  }
}
