:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --ink: #1f2933;
  --muted: #66727f;
  --line: #d9ded7;
  --panel: #ffffff;
  --accent: #2f6f73;
  --accent-strong: #21565a;
  --amber: #c88a2d;
  --danger: #b94242;
  --shadow: 0 18px 40px rgba(33, 45, 48, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(47, 111, 115, 0.12), transparent 36%),
    linear-gradient(315deg, rgba(200, 138, 45, 0.14), transparent 30%),
    var(--bg);
  font-family: "Segoe UI", "Noto Sans TC", system-ui, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  min-height: 100vh;
}

.login-view {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

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

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 8vw, 3.25rem);
  line-height: 1;
}

.login-form {
  display: grid;
  gap: 18px;
  margin-top: 32px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
}

input:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(47, 111, 115, 0.18);
}

.login-form button,
.primary-button {
  min-height: 48px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

.login-form button:hover,
.primary-button:hover {
  background: var(--accent-strong);
}

.form-error {
  min-height: 1.3em;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
}

.app-view {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0 28px;
}

.user-area {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

.ghost-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}

.ghost-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.recording-list,
.player-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.recording-list {
  overflow: hidden;
}

.list-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.list-header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.list-header span {
  display: inline-grid;
  min-width: 32px;
  min-height: 32px;
  place-items: center;
  border-radius: 999px;
  color: #fff;
  background: var(--accent);
  font-weight: 800;
}

#recordings {
  display: grid;
  max-height: calc(100vh - 170px);
  overflow: auto;
}

.recording-button {
  display: grid;
  gap: 7px;
  width: 100%;
  min-height: 96px;
  border-bottom: 1px solid var(--line);
  padding: 16px 18px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.recording-button:hover,
.recording-button.active {
  background: #eef6f4;
}

.recording-title {
  font-weight: 850;
}

.recording-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: var(--muted);
  font-size: 0.88rem;
}

.recording-badge {
  color: var(--amber);
  font-weight: 800;
}

.player-panel {
  display: grid;
  gap: 22px;
  min-height: 520px;
  padding: 28px;
}

.now-playing h2 {
  margin: 0;
  font-size: clamp(1.75rem, 5vw, 3rem);
  line-height: 1.08;
}

.now-playing p:last-child {
  max-width: 680px;
  margin: 16px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

audio {
  width: 100%;
}

.transcript-panel {
  display: grid;
  gap: 18px;
  align-self: end;
  min-height: 170px;
  border: 1px dashed #b8c1bd;
  border-radius: 8px;
  padding: 20px;
  background: #fbfaf6;
}

.transcript-panel h3 {
  margin: 0;
  font-size: 1.25rem;
}

.transcript-panel p:last-child {
  margin: 0;
  color: var(--muted);
}

[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  .app-view {
    padding: 18px;
  }

  .topbar,
  .user-area {
    align-items: flex-start;
  }

  .topbar {
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  #recordings {
    max-height: none;
  }

  .player-panel {
    min-height: auto;
    padding: 20px;
  }
}
