/* LA2L Sender. No inline styles anywhere: the Content-Security-Policy allows only this file. */

:root {
  --bg: #f4f2ed;
  --card: #ffffff;
  --line: #d8d3c8;
  --text: #1c1b18;
  --muted: #5d594f;
  --accent: #b4420e;
  --accent-text: #ffffff;
  --field: #ffffff;
  --ok: #1f7a3a;
  --bad: #b42318;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131210;
    --card: #1d1b18;
    --line: #36322c;
    --text: #ece8df;
    --muted: #a39d91;
    --accent: #f0a23a;
    --accent-text: #1b1306;
    --field: #15140f;
    --ok: #5cc17a;
    --bad: #ff8a7a;
  }
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

.top,
main,
.foot {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 16px;
}

.top {
  display: flex;
  gap: 16px;
  align-items: center;
  padding-top: 24px;
  padding-bottom: 8px;
}

.top img {
  flex: none;
  border-radius: 50%;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
}

.top p {
  margin: 2px 0 0;
  color: var(--muted);
}

.card {
  margin: 16px 0;
  padding: 18px 20px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
}

h2 {
  display: flex;
  gap: 10px;
  align-items: center;
  margin: 0 0 10px;
  font-size: 1.2rem;
}

.step {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  font-size: 0.95rem;
}

label {
  display: block;
  margin: 12px 0 6px;
  font-weight: 600;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

input,
select {
  flex: 1 1 180px;
  min-width: 0;
  min-height: 52px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
  font: inherit;
}

select {
  padding-right: 8px;
}

#code {
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

button {
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-text);
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

button.secondary {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
}

button:disabled,
input:disabled,
select:disabled {
  opacity: 0.55;
  cursor: default;
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
.choose:focus-within {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

button.small {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.95rem;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

/* Fields side by side where they fit, one under the other on a phone. */
.fields {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 4px 12px;
}

/* The label sits right above its field; fields in one row line up at the bottom, also when a
   label takes two lines. */
.field {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
}

.field.wide {
  grid-column: 1 / -1;
}

.field input,
.field select {
  flex: none;
  width: 100%;
  font-weight: 400;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 400;
}

/* The file input sits under its label, which looks like a button. */
.choose {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: 52px;
  margin: 18px 0 4px;
  padding: 0 24px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
}

.choose input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  opacity: 0;
  pointer-events: none;
}

fieldset:disabled .choose {
  opacity: 0.55;
  cursor: default;
}

.sounds {
  margin: 8px 0 18px;
  padding: 0;
  list-style: none;
}

.sound {
  margin: 0 0 12px;
  padding: 12px 14px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.sound-head {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.file-name {
  overflow-wrap: anywhere;
  font-weight: 650;
}

.sound-head .remove {
  min-height: 40px;
  padding: 0 14px;
  font-size: 0.95rem;
}

.progress {
  display: block;
  width: 100%;
  height: 10px;
  margin-top: 12px;
  accent-color: var(--accent);
}

.sent-status {
  margin: 0 0 12px;
  font-size: 1.15rem;
}

.items {
  margin: 0 0 14px;
  padding-left: 20px;
  color: var(--bad);
}

.items:empty {
  display: none;
}

.recent {
  margin: 0;
  padding: 0;
  list-style: none;
}

.recent li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

.recent li:first-child {
  border-top: 0;
  padding-top: 0;
}

.recent p {
  margin: 4px 0 0;
}

.paired {
  margin: 0 0 14px;
  color: var(--ok);
  font-size: 1.15rem;
}

.message:empty {
  display: none;
}

.message {
  margin: 12px 0 0;
}

.message.bad {
  color: var(--bad);
}

.ok {
  color: var(--ok);
}

.bad {
  color: var(--bad);
}

.wait {
  color: var(--muted);
}

.foot {
  padding-bottom: 32px;
  font-size: 0.9rem;
}
