/* Full updated CSS with layout refactor applied */

:root {
  --background-color: #131313;
  --primary-color: #1a1a1d;
  --secondary-color: #3a3a3a;
  --accent-color: #cba96c;
  --sigil-color: #f9ffe3;
  --text-color: #f1e9d8;
  --action-color: #6c2dc7;
  --font-family: 'Cormorant Garamond', serif;
  --font-size: 16px;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: var(--background-color);
  color: var(--text-color);
  font-family: var(--font-family);
  font-size: var(--font-size);
  margin: 0;
  padding: 0;
}

h1,
h2,
h3 {
  margin: 16px 0 8px 0;
  text-align: center;
  background: var(--primary-color);
  padding: 8px 16px;
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  border-bottom: 2px solid var(--accent-color);
}

.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 720px;
  background-color: var(--primary-color);
  border: 1px solid var(--secondary-color);
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  margin: 16px auto;
  padding: 16px;
  transition: transform 0.2s ease;
  gap: 12px;
  box-sizing: border-box;
}

.card:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.card-list {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  padding: 8px 0;
  gap: 12px;
  list-style: none;
  margin: 0;
  border-left: 1px solid var(--accent-color);
  border-right: 1px solid var(--accent-color);
  box-sizing: border-box;
}

.card-list > li {
  width: 100%;
  display: flex;
  justify-content: center;
}

#schedule-table {
  width: 80%;
  border-collapse: collapse;
  margin: 16px 0;
}

a {
  color: var(--accent-color);
  text-decoration: none;
  transition: all 0.2s ease;
  display: inline-block;
  background: var(--secondary-color);
  padding: 4px 8px;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  text-align: center;
}

a:hover {
  text-decoration: underline;
  transform: scale(1.125);
  background: var(--action-color);
  box-shadow: 0 4px 8px rgba(203, 169, 108, 1);
}

button {
  background: var(--secondary-color);
  color: var(--text-color);
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

button:hover {
  background: var(--action-color);
  box-shadow: 0 4px 8px rgba(203, 169, 108, 1);
  transform: scale(1.1);
}

h1 img,
h2 img {
  height: 1.5em;
  vertical-align: middle;
  transition: transform 0.5s ease;
  display: inline-block;
}

h2 img {
  height: 1.2em;
}

h1 img:hover {
  transform: rotate(20deg);
}

.streamer-emote {
  margin: 16px 0;
  transition: transform 0.5s ease;
}

.streamer-emote:hover {
  transform: rotate(-10deg);
}

.sigils {
  display: flex;
  justify-content: center;
  padding: 48px 0 16px;
}

.sigil-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 75%;
  background-color: var(--primary-color);
  border: 1px solid var(--secondary-color);
  border-radius: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  margin: 16px;
  padding: 16px;
  width: 300px;
  transition: transform 0.2s ease;
  gap: 8px;
}

.sigils img {
  max-width: 50%;
  border-radius: 4px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  background: var(--sigil-color);
  border: 2px solid var(--accent-color);
  border-radius: 100px;
  aspect-ratio: 1;
  align-self: center;
}

canvas {
  background: var(--sigil-color);
  border: 2px solid var(--accent-color);
  margin-top: 1rem;
  border-radius: 8px;
  width: 90%;
  height: auto;
  aspect-ratio: 1;
}

footer {
  margin-top: 32px;
  padding: 16px;
  width: 100%;
  text-align: center;
  background-color: var(--primary-color);
  border-top: 2px solid var(--accent-color);
}

.layout {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

#sigilCanvas {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1;
  height: auto;
  display: block;
  margin: 0 auto;
  background: #fafafa;
  border: 1px solid #333;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 10px;
  margin: 8px 0;
}

.controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--primary-color);
  border: 1px solid var(--secondary-color);
  width: 100%;
  max-width: 100%;
  justify-content: space-between;
}

.controls input[type="range"] {
  flex: 1 1 auto;
  min-width: 140px;
  max-width: 95%;
  margin-left: 8px;
}

.controls input[type="text"],
.controls input[type="color"],
.controls input[type="range"] {
  accent-color: var(--accent-color);
}

.controls select {
  background: var(--secondary-color);
  color: var(--text-color);
  border: 1px solid var(--secondary-color);
  border-radius: 6px;
  padding: 6px 8px;
}

.control-field {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(220px, 1fr));
  gap: 12px;
}

#error-img {
  max-width: 50%;
  height: auto;
  aspect-ratio: 1;
  display: block;
  margin: 16px auto;
}

@media (max-width: 900px) {
  body {
    padding: 8px;
  }

  .card {
    max-width: 95vw;
    padding: 12px;
    margin: 8px auto;
    align-items: stretch;
    box-sizing: border-box;
  }

  .card:hover {
    transform: none;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  }

  .card-list {
    border-left: none;
    border-right: none;
  }

  .settings-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .settings-column {
    width: 100%;
  }

  details {
    width: 100%;
    padding: 6px 10px;
  }

  summary {
    font-size: 1rem;
  }

  .controls {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    width: 95%;
    max-width: 95%;
    margin: 0 auto;
    box-sizing: border-box;
  }

  .controls label {
    width: 100%;
    max-width: 100%;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 4px;
    white-space: normal;
    word-break: break-word;
    box-sizing: border-box;
  }

  .controls input[type="range"],
  .controls input[type="text"],
  .controls input[type="color"],
  .controls select {
    width: 100%;
    max-width: 100%;
    margin-left: 0;
    margin-top: 4px;
  }

  .control-field {
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  h2, h3 {
    font-size: 1.2rem;
  }
}