:root {
  --bg: #f5efe4;
  --card: rgba(255, 250, 242, 0.92);
  --line: #d6c4aa;
  --text: #2f2418;
  --muted: #6a5846;
  --accent: #c15b2a;
  --accent-strong: #8f3410;
  --ok: #276749;
  --error: #b83232;
  --shadow: 0 20px 60px rgba(84, 53, 29, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 212, 148, 0.6), transparent 35%),
    radial-gradient(circle at bottom right, rgba(193, 91, 42, 0.14), transparent 30%),
    var(--bg);
  font-family: "Hiragino Sans", "Yu Gothic", sans-serif;
  overflow-x: hidden;
}

.shell {
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
}

.card {
  background: var(--card);
  border: 1px solid rgba(214, 196, 170, 0.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.hero {
  background:
    linear-gradient(135deg, rgba(193, 91, 42, 0.12), rgba(255, 255, 255, 0.8)),
    var(--card);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.8rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.9rem, 4vw, 3rem);
}

.lead {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid > * {
  min-width: 0;
}

.wide,
button[type="submit"] {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 700;
  min-width: 0;
}

input,
select {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.86);
  width: 100%;
  max-width: 100%;
}

button,
.button-link {
  appearance: none;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  font: inherit;
  color: var(--text);
  background: rgba(255, 255, 255, 0.86);
  max-width: 100%;
}

input:focus,
select:focus {
  outline: 2px solid rgba(193, 91, 42, 0.25);
  border-color: var(--accent);
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff8f4;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

button[disabled] {
  opacity: 0.6;
  cursor: wait;
}

.preview-box {
  border: 1px dashed var(--line);
  border-radius: 18px;
  padding: 16px;
  background: rgba(255, 248, 240, 0.72);
}

.label {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--muted);
}

.preview-value {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  word-break: break-word;
}

.subtle {
  color: var(--muted);
  margin: 8px 0 0;
}

.error-list {
  padding: 14px 16px;
  border-radius: 16px;
  color: #fff;
  background: var(--error);
  line-height: 1.7;
}

.info-list {
  padding: 14px 16px;
  border-radius: 16px;
  color: var(--text);
  background: rgba(193, 91, 42, 0.12);
  line-height: 1.7;
}

.auth-dialog {
  width: min(460px, calc(100% - 24px));
  border: 1px solid rgba(214, 196, 170, 0.9);
  border-radius: 24px;
  padding: 0;
  background: rgba(255, 250, 242, 0.98);
  box-shadow: 0 24px 70px rgba(47, 36, 24, 0.25);
}

.auth-dialog::backdrop {
  background: rgba(47, 36, 24, 0.42);
  backdrop-filter: blur(6px);
}

.auth-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}

.readonly-box {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  background: rgba(245, 239, 228, 0.9);
  min-height: 54px;
  width: 100%;
  max-width: 100%;
  display: flex;
  align-items: center;
  overflow-wrap: anywhere;
}

.progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-bar {
  height: 14px;
  border-radius: 999px;
  background: rgba(214, 196, 170, 0.5);
  overflow: hidden;
}

#progress-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #f0ad4e, var(--accent));
  transition: width 120ms ease;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.song-settings-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.song-row {
  display: flex;
  gap: 10px;
  align-items: end;
}

.song-row > * {
  min-width: 0;
}

.remove-row-button {
  white-space: nowrap;
}

.download-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 126px;
}

.subtle-action {
  color: var(--muted);
  font-size: 0.9rem;
}

.grow {
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px 10px;
  border-bottom: 1px solid rgba(214, 196, 170, 0.7);
  text-align: left;
  white-space: nowrap;
}

tbody tr:hover {
  background: rgba(255, 244, 230, 0.65);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.85rem;
  font-weight: 700;
  background: rgba(193, 91, 42, 0.15);
  color: var(--accent-strong);
}

.status-badge.uploaded {
  background: rgba(39, 103, 73, 0.14);
  color: var(--ok);
}

.status-badge.failed {
  background: rgba(184, 50, 50, 0.14);
  color: var(--error);
}

.result-title {
  margin-top: 0;
}

@media (max-width: 720px) {
  .shell {
    width: calc(100% - 20px);
    max-width: 960px;
    padding-top: 20px;
  }

  .card {
    padding: 18px;
    border-radius: 18px;
  }

  .form-grid {
    display: flex;
    flex-direction: column;
    gap: 16px;
  }

  .form-grid > * {
    width: 100%;
    max-width: 100%;
  }

  .wide,
  button[type="submit"] {
    grid-column: auto;
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head,
  .song-row {
    flex-direction: column;
    align-items: stretch;
  }

  .section-head > *,
  .song-row > * {
    width: 100%;
  }

  .auth-dialog {
    width: calc(100% - 16px);
    margin: 8px;
  }

  th,
  td {
    white-space: normal;
  }

  #logout-button,
  #add-song-row,
  #delete-all-button,
  .remove-row-button,
  .download-button {
    width: 100%;
    min-width: 0;
  }

  input[type="file"] {
    min-width: 0;
  }
}
