:root {
  --ink: #1d2e3e;
  --muted: #60707d;
  --navy: #18364c;
  --sky: #3a7ca5;
  --blue: #3a7ca5;
  --mint: #dfeeea;
  --cream: #f7f5ee;
  --line: #d5dde2;
  --white: #ffffff;
  --danger: #bf4a4a;
  --header-height: 100px;
  --shadow: 0 8px 24px rgba(23, 53, 74, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, sans-serif;
  background: var(--mint);
  color: var(--ink);
}

button,
select,
input {
  font: inherit;
}

.header {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: var(--header-height);
  background: var(--sky);
}

#logo {
  display: block;
  height: calc(var(--header-height) * 0.9);
  width: auto;
  max-width: 160px;
  object-fit: contain;
  border-radius: 50%;
}
#version {
    display: flex;
    /*justify-content: center;*/
    
    align-items:flex-end;
    height:var(--header-height);
    margin-left:1rem;
    margin-bottom:calc(var(--header-height) * 0.2);
    width:10rem;
}
.container {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.4fr);
  gap: 1.5rem;
  width: min(92vw, 1100px);
  margin: 1.5rem auto 0;
  padding: 1.5rem;
  background: linear-gradient(180deg, #f9f7f2 0%, #f3f3ef 100%);
  border: 1px solid rgba(24, 54, 76, 0.05);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(17, 42, 52, 0.08);
}

.column {
  min-height: 240px;
  padding: 1rem 1rem 0.75rem;
  background: rgba(255, 255, 255, 0.82);
  border-radius: 16px;
  border: 1px solid rgba(24, 54, 76, 0.05);
  box-shadow: 0 10px 24px rgba(20, 40, 52, 0.04);
}

.otolist {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

label {
  display: grid;
  gap: 0.45rem;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 700;
}

label.for_parts{
  display: grid;
  gap: 0.45rem;
  font-size: 1rem;
  color: var(--ink);
  font-weight: 700;
}

select,
input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.75rem 0.8rem;
  color: var(--ink);
  background: var(--white);
}

select.pitch_selector {
  width: 100%;
}

#add-card {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  width: auto;
  padding: 0.75rem 1rem;
  border: 0;
  border-radius: 12px;
  color: var(--white);
  background: linear-gradient(135deg, #4aa1d6 0%, #2d6ea3 100%);
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(45, 110, 163, 0.18);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

#add-card:hover,
.card-delete:hover,
.dialog-actions button:hover,
.play-button:hover,
.stop-button:hover {
  transform: translateY(-1px);
  filter: brightness(0.98);
}

button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(58, 124, 165, 0.25);
  outline-offset: 2px;
}

.card-limit-message {
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
}

#card-container {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0 0 0.5rem;
}

.sound-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  width: 100%;
  padding: 1rem;
  border: 1px solid rgba(24, 54, 76, 0.08);
  border-radius: 14px;
  background: linear-gradient(180deg, #ffffff 0%, #f7fafb 100%);
  box-shadow: 0 8px 18px rgba(21, 46, 60, 0.04);
  cursor: pointer;
  transition: opacity 0.18s ease, filter 0.18s ease, transform 0.18s ease;
}

.sound-card.is-inactive {
  opacity: 0.58;
  filter: grayscale(0.25);
  transform: scale(0.995);
}

.card-check {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 36px;
  height: 20px;
}

.card-check input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.slider {
  position: absolute;
  inset: 0;
  background-color: #cbd3d9;
  border-radius: 17px;
  transition: 0.3s ease;
}

.slider::before {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  left: 3px;
  bottom: 3px;
  background: var(--white);
  border-radius: 50%;
  transition: 0.3s ease;
}

.card-check input:checked + .slider {
  background-color: #2196f3;
}

.card-check input:checked + .slider::before {
  transform: translateX(16px);
}

.card-summary,
.card-tone {
  display: flex;
  flex: 1 1 0;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
}

.card-summary strong,
.card-tone strong,
.card-frequency {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 700;
}

.card-summary span,
.card-tone span {
  color: var(--muted);
  font-size: 0.8rem;
}

.card-delete {
  flex: 0 0 auto;
  padding: 0.45rem 0.7rem;
  border: 1px solid var(--danger);
  border-radius: 8px;
  color: var(--danger);
  background: var(--white);
  cursor: pointer;
}

#card-dialog {
  width: min(90vw, 360px);
  border: 0;
  padding: 0;
  border-radius: 12px;
  box-shadow: 0 16px 50px rgba(23, 53, 74, 0.35);
}

#card-dialog::backdrop {
  background: rgba(23, 53, 74, 0.65);
}

#card-form {
  display: grid;
  gap: 1rem;
  padding: 1.5rem;
}

#card-form h2 {
  margin: 0;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 0.25rem;
}

.dialog-actions button {
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  font-weight: 700;
}

.dialog-actions .primary {
  border-color: transparent;
  color: var(--white);
  background: linear-gradient(135deg, #4aa1d6 0%, #2d6ea3 100%);
  box-shadow: 0 10px 18px rgba(45, 110, 163, 0.18);
}

.sound_area {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.play_area {
  display: flex;
  justify-content: center;
  gap: 0.8rem;
  width: 100%;
  padding: 0.25rem 0 0.5rem;
}

.play-button,
.stop-button {
  width: 7rem;
  height: 2.9rem;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #f4f7fb 0%, #eaf0f5 100%);
  color: var(--ink);
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: 0 10px 18px rgba(31, 55, 73, 0.08);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease, opacity 0.18s ease;
}

.play-button:hover,
.stop-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 22px rgba(31, 55, 73, 0.12);
}

.play-button {
  background: linear-gradient(135deg, #2ec27f 0%, #1f9d61 100%);
  color: var(--white);
}

.stop-button {
  background: linear-gradient(135deg, #ff7b7b 0%, #d84d4d 100%);
  color: var(--white);
}

.play-button.is-active {
  background: linear-gradient(135deg, #21a75d 0%, #177b4d 100%);
  box-shadow: 0 10px 18px rgba(33, 167, 93, 0.24);
}

.stop-button.is-active {
  background: linear-gradient(135deg, #d94d4d 0%, #b13131 100%);
  box-shadow: 0 10px 18px rgba(217, 77, 77, 0.22);
}

.play-button:not(.is-active),
.stop-button:not(.is-active) {
  opacity: 0.92;
  filter: saturate(0.85);
}

.graph_area {
  display: grid;
  gap: 1rem;
}

.graph_area label {
  display: block;
  margin: 0;
}

canvas {
  display: block;
  width: 100%;
  height: 120px;
  margin-top: 0.5rem;
  background: #000;
  border-radius: 8px;
}

.footer {
  width: 100%;
  padding: 0.8rem 1rem;
  margin-top: 1.5rem;
  background: var(--sky);
  color: var(--white);
  font-size: 0.8rem;
  text-align: center;
}

@media (max-width: 900px) {
  .container {
    grid-template-columns: 1fr;
  }

  .column {
    min-height: auto;
  }
}

@media (max-width: 520px) {
  :root {
    --header-height: 82px;
  }

  .container {
    width: min(94vw, 100%);
    margin-top: 1rem;
    padding: 0.75rem;
    gap: 0.85rem;
  }

  .column {
    padding: 0.9rem 0.8rem 0.75rem;
  }

  .play_area {
    flex-wrap: wrap;
  }

  .play-button,
  .stop-button {
    flex: 1 1 140px;
  }

  .sound-card {
    gap: 0.75rem;
    padding: 0.75rem;
  }
}

