:root {
  --accent: #2ba6cb;
  --accent-dark: #2284a1;
  --text: #222;
  --muted: #6f6f6f;
  --rule: #ddd;
  --error: #c60f13;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Class rules below set `display`, which would otherwise beat the user agent's
   `[hidden] { display: none }` and leave hidden sections on screen. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  padding: 0 1rem 3rem;
  color: var(--text);
  font: 16px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: #fff;
}

.row {
  max-width: 40rem;
  margin: 0 auto;
}

h2 {
  margin: 1.5rem 0 0.5rem;
  font-weight: 400;
}

h4 {
  margin: 0.5rem 0;
  font-weight: 400;
}

hr {
  border: none;
  border-top: 1px solid var(--rule);
  margin: 0 0 1.5rem;
}

.centered {
  text-align: center;
}

.muted {
  color: var(--muted);
  font-size: 0.875rem;
}

img {
  max-width: 100%;
  height: auto;
}

.button {
  display: inline-block;
  padding: 0.6rem 1.4rem;
  border: none;
  border-radius: 3px;
  background: var(--accent);
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
}

.button:hover:not(:disabled) {
  background: var(--accent-dark);
}

.button:disabled {
  opacity: 0.5;
  cursor: default;
}

.link {
  border: none;
  background: none;
  padding: 0;
  color: var(--muted);
  font-size: 0.8125rem;
  text-decoration: underline;
  cursor: pointer;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 18rem;
  margin: 3rem auto;
}

.panel input {
  padding: 0.6rem;
  border: 1px solid #ccc;
  border-radius: 3px;
  font-size: 1.25rem;
  text-align: center;
}

.error {
  margin: 0;
  color: var(--error);
}

/* Transient "Command sent" feedback under the button. */
.result {
  min-height: 1.5rem;
  margin: 0;
  color: var(--muted);
  opacity: 0;
  transition: opacity 1.5s ease-out;
}

.result.visible {
  opacity: 1;
  transition: none;
}

#history-panel {
  margin-top: 2.5rem;
  text-align: left;
}

#history-panel summary {
  cursor: pointer;
  color: var(--muted);
}

.history {
  margin: 0.75rem 0 0;
  padding: 0;
  list-style: none;
}

.history li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.875rem;
}

.history time {
  color: var(--muted);
  white-space: nowrap;
}
