:root {
  --bg: #10131a;
  --panel: #1a1f2b;
  --panel2: #252c3d;
  --panel3: #121824;
  --text: #f5f7fb;
  --sub: #aeb8cc;
  --accent: #4cc9f0;
  --train: #2ecc71;
  --interval: #f39c12;
  --danger: #ff5d73;
  --border: #33405a;
  --border2: #44506b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Hiragino Sans", "Yu Gothic UI", sans-serif;
  background: linear-gradient(180deg, #0d1117, #141a24);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
}

.app {
  width: 100%;
  max-width: 760px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.language-switch {
  display: flex;
  justify-content: flex-end;
  gap: 16px;
  padding: 14px 24px 0;
  font-size: 0.95rem;
}

.language-switch a {
  color: var(--sub);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s ease, opacity 0.2s ease;
}

.language-switch a:hover {
  color: var(--text);
}

.language-switch a.active {
  color: var(--accent);
}

.header {
  padding: 20px 24px;
  background: linear-gradient(135deg, #1f2635, #171c27);
  border-bottom: 1px solid var(--border);
}

.header h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.header p {
  margin: 0;
  color: var(--sub);
  line-height: 1.6;
}

.content {
  padding: 24px;
}

.settings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.field {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
}

.field label {
  display: block;
  font-size: 0.95rem;
  color: var(--sub);
  margin-bottom: 10px;
}

.field input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1.1rem;
  border: 1px solid #4b5b7d;
  border-radius: 10px;
  background: #0f1420;
  color: var(--text);
  outline: none;
}

.field input:focus,
.menu-name-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(76, 201, 240, 0.15);
}

.menu-save-panel {
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 20px;
}

.menu-save-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: end;
}

.menu-name-wrap {
  flex: 1 1 260px;
}

.menu-name-wrap label {
  display: block;
  font-size: 0.95rem;
  color: var(--sub);
  margin-bottom: 10px;
}

.menu-name-wrap input {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  border: 1px solid #4b5b7d;
  border-radius: 10px;
  background: #0f1420;
  color: var(--text);
  outline: none;
}

.display {
  background: #0f1420;
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  text-align: center;
  margin-bottom: 20px;
}

.mode {
  display: inline-block;
  min-width: 150px;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: bold;
  font-size: 1rem;
  margin-bottom: 16px;
  border: 1px solid transparent;
}

.mode.train {
  background: rgba(46, 204, 113, 0.15);
  color: #83f0af;
  border-color: rgba(46, 204, 113, 0.35);
}

.mode.interval {
  background: rgba(243, 156, 18, 0.15);
  color: #ffc66b;
  border-color: rgba(243, 156, 18, 0.35);
}

.mode.ready {
  background: rgba(76, 201, 240, 0.15);
  color: #9ce9ff;
  border-color: rgba(76, 201, 240, 0.35);
}

.mode.finish {
  background: rgba(255, 93, 115, 0.15);
  color: #ff9ba9;
  border-color: rgba(255, 93, 115, 0.35);
}

.time {
  font-size: clamp(3rem, 10vw, 6rem);
  font-weight: 800;
  line-height: 1;
  margin-bottom: 14px;
  letter-spacing: 2px;
}

.info {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  color: var(--sub);
  font-size: 1rem;
}

.info strong,
.current-menu strong {
  color: var(--text);
}

.buttons {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

button {
  appearance: none;
  border: none;
  border-radius: 12px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, opacity 0.2s ease, background 0.2s ease;
}

button:active {
  transform: translateY(1px);
}

.start {
  background: var(--train);
  color: white;
  flex: 1 1 180px;
}

.pause {
  background: var(--interval);
  color: white;
  flex: 1 1 140px;
}

.reset {
  background: #44506b;
  color: white;
  flex: 1 1 140px;
}

.menu-open {
  background: #3478f6;
  color: white;
  min-width: 140px;
}

.menu-save {
  background: #7b61ff;
  color: white;
  min-width: 160px;
}

.secondary-btn {
  background: #44506b;
  color: white;
}

.sound-control,
.menu-list-panel {
  margin-top: 20px;
  background: var(--panel2);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.sound-control-header,
.menu-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.sound-control-title,
.menu-list-title {
  font-size: 0.95rem;
  color: var(--sub);
}

.sound-value {
  font-weight: 700;
  color: var(--text);
  min-width: 56px;
  text-align: right;
}

.sound-control input[type="range"] {
  width: 100%;
  cursor: pointer;
}

.menu-list-panel.hidden {
  display: none;
}

.menu-empty {
  color: var(--sub);
  line-height: 1.7;
  padding: 8px 0;
}

.menu-items {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-item {
  background: var(--panel3);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.menu-item-left {
  flex: 1 1 250px;
  min-width: 0;
}

.menu-item-name {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 6px;
  word-break: break-word;
}

.menu-item-detail {
  color: var(--sub);
  font-size: 0.95rem;
  line-height: 1.6;
}

.menu-item-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.apply-btn {
  background: #2ecc71;
  color: white;
  padding: 10px 14px;
  font-size: 0.95rem;
}

.delete-btn {
  background: #ff5d73;
  color: white;
  padding: 10px 14px;
  font-size: 0.95rem;
}

.current-menu {
  margin-top: 12px;
  color: var(--sub);
  font-size: 0.95rem;
  line-height: 1.6;
}

.note {
  margin-top: 16px;
  color: var(--sub);
  line-height: 1.7;
  font-size: 0.95rem;
}

.disclaimer {
  margin-top: 14px;
  color: var(--sub);
  font-size: 0.68rem;
  line-height: 1.7;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}

@media (max-width: 640px) {
  .settings {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 16px;
  }

  .display {
    padding: 18px;
  }

  .menu-save,
  .menu-open {
    width: 100%;
  }

  .menu-item-buttons {
    width: 100%;
  }

  .apply-btn,
  .delete-btn {
    flex: 1 1 120px;
  }

  .language-switch {
    padding: 14px 16px 0;
  }
}