*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  background: #0f0f1a;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  padding: 1rem;
}
.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: 480px;
  width: 100%;
}
.wc-link {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .8rem 1rem;
  font-size: .85rem;
  font-weight: 600;
  background: linear-gradient(135deg, #1a3a1a, #1a1a2e);
  border: 1.5px solid #22c55e;
  border-radius: 1rem;
  color: #fff;
  text-decoration: none;
  transition: all .15s;
  text-align: left;
  line-height: 1.3;
}
.wc-link:hover { background: linear-gradient(135deg, #2a4a2a, #2a2a3e); border-color: #4f6ef7; transform: scale(1.02); }
.wc-link:active { transform: scale(.98); }
.wc-arrow {
  font-size: 1.3rem;
  flex-shrink: 0;
  color: #22c55e;
  transition: transform .15s;
}
.wc-link:hover .wc-arrow { transform: translateX(4px); }
.ad {
  background: #12121f;
  border: 1.5px dashed #2a2a44;
  border-radius: 1rem;
  color: #444466;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  user-select: none;
}
.ad-top { height: 60px; }
.ad-bottom { height: 60px; }
.ad-inline {
  height: 60px;
  width: 100%;
  background: #12121f;
  border: 1.5px dashed #2a2a44;
  border-radius: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 1rem;
  overflow: hidden;
}
.container {
  background: #1a1a2e;
  border-radius: 2rem;
  padding: 3rem 2.5rem;
  box-shadow: 0 25px 50px -12px rgba(0,0,0,.8);
  text-align: center;
  max-width: 480px;
  width: 100%;
}
.top-bar {
  margin: -3rem -2.5rem 1.5rem;
  border-radius: 2rem 2rem 0 0;
  overflow: hidden;
}
.lang-switch { display: flex; }
.lang-switch button {
  flex: 1;
  font-size: 0;
  line-height: 1;
  background: none;
  border: none;
  border-bottom: 2px solid rgba(255,255,255,.08);
  cursor: pointer;
  padding: .5rem 0;
  opacity: .35;
  transition: opacity .15s;
  filter: grayscale(.6);
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  min-height: 1.5rem;
}
.lang-switch button.active { opacity: 1; filter: none; }
.lang-switch button:hover { opacity: .7; filter: none; }

h1 {
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #8888aa;
  margin-bottom: 1.5rem;
}
.display {
  font-size: clamp(3.5rem, 15vw, 6rem);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: .03em;
  line-height: 1.2;
  color: #f0f0ff;
  text-shadow: 0 0 40px rgba(100,140,255,.15);
  margin-bottom: .3rem;
  transition: color .2s;
}
.display.running { color: #6ee7b7; text-shadow: 0 0 60px rgba(110,231,183,.25); }
.display.paused { color: #fbbf24; text-shadow: 0 0 60px rgba(251,191,36,.2); }
.display.ended { color: #f87171; text-shadow: 0 0 60px rgba(248,113,113,.3); }

.label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #666688;
  margin-bottom: 2rem;
  min-height: 1.2em;
}

.input-group {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}
.input-group input {
  width: 4.2rem;
  padding: .6rem .4rem;
  text-align: center;
  font-size: 1.3rem;
  font-weight: 600;
  background: #12121f;
  border: 1.5px solid #2a2a44;
  border-radius: .75rem;
  color: #fff;
  outline: none;
  transition: border-color .2s;
}
.input-group input:focus { border-color: #4f6ef7; }
.input-group input::placeholder { color: #444466; font-weight: 400; }
.input-group span {
  font-size: 1.3rem;
  font-weight: 600;
  color: #8888aa;
  align-self: center;
}
.input-group .input-label {
  font-size: .9rem;
  font-weight: 400;
  color: #666688;
  margin-right: .2rem;
}

.actions {
  display: flex;
  gap: .6rem;
  justify-content: center;
  flex-wrap: wrap;
}
.actions button {
  padding: .7rem 1.6rem;
  font-size: .95rem;
  font-weight: 600;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  transition: all .15s;
  background: #2a2a44;
  color: #ccd;
}
.actions button:active { transform: scale(.95); }
.actions .start  { background: #22c55e; color: #0a0a1a; }
.actions .start:hover  { background: #16a34a; }
.actions .start:disabled { background: #1a3a2a; color: #446655; cursor: not-allowed; }
.actions .pause  { background: #eab308; color: #0a0a1a; }
.actions .pause:hover  { background: #ca8a04; }
.actions .pause:disabled { background: #3a3520; color: #887744; cursor: not-allowed; }
.actions .delete { background: #ef4444; color: #fff; border: none; }
.actions .delete:hover { background: #dc2626; }
.actions .delete:disabled { background: #5a2a2a; color: #886666; cursor: not-allowed; }
.actions .stop { background: #ef4444; color: #fff; }
.actions .stop:hover { background: #dc2626; }

.sound-select {
  margin-bottom: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
}
.sound-select label {
  font-size: .8rem;
  color: #8888aa;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.sound-select select {
  background: #12121f;
  color: #ddd;
  border: 1.5px solid #2a2a44;
  border-radius: .75rem;
  padding: .4rem .8rem;
  font-size: .85rem;
  cursor: pointer;
  outline: none;
  max-width: 180px;
}
.sound-select select:focus { border-color: #4f6ef7; }
.sound-select .preview {
  background: #2a2a44;
  border: none;
  border-radius: .5rem;
  color: #aaa;
  cursor: pointer;
  font-size: .9rem;
  padding: .35rem .5rem;
  line-height: 1;
  transition: all .15s;
}
.sound-select .preview:hover { background: #3a3a55; color: #fff; }
.sound-select .preview:active { transform: scale(.9); }

.presets {
  display: flex;
  gap: .5rem;
  justify-content: center;
  margin-bottom: 1.8rem;
  flex-wrap: wrap;
}
.presets button {
  padding: .35rem 1rem;
  font-size: .8rem;
  font-weight: 500;
  border-radius: 1.5rem;
  border: 1.5px solid #2a2a44;
  background: transparent;
  color: #8888aa;
  cursor: pointer;
  transition: all .15s;
}
.presets button:hover { background: #2a2a44; color: #ddd; }

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}
.modal-overlay.open { display: flex; }
.modal-box {
  background: #1a1a2e;
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 30px 60px rgba(0,0,0,.8);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  position: relative;
}
.modal-close {
  position: absolute;
  top: .7rem;
  right: .7rem;
  background: none;
  border: none;
  color: #666688;
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
  padding: .2rem;
  transition: color .15s;
}
.modal-close:hover { color: #fff; }
.modal-ad {
  width: 300px;
  height: 250px;
  background: #12121f;
  border: 1.5px dashed #2a2a44;
  border-radius: .75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #444466;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  user-select: none;
}
.cal-hint {
  font-size: .75rem;
  color: #555577;
  font-style: italic;
  margin-top: 1.5rem;
  margin-bottom: .4rem;
}
.cal-toggle-btn {
  display: block;
  width: 100%;
  padding: .7rem;
  font-size: .9rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  background: #2a2a44;
  color: #aaa;
  border: 1.5px solid #2a2a44;
  border-radius: .75rem;
  cursor: pointer;
  transition: all .15s;
}
.cal-toggle-btn:hover { background: #3a3a55; color: #ddd; border-color: #4f6ef7; }
.cal-toggle-btn:active { transform: scale(.98); }
.cal-toggle-btn.open { border-radius: .75rem .75rem 0 0; }
.cal-input-row {
  display: flex;
  gap: .5rem;
  margin-top: .6rem;
}
.cal-input-row input {
  flex: 1;
  padding: .5rem .6rem;
  font-size: .8rem;
  background: #12121f;
  border: 1.5px solid #2a2a44;
  border-radius: .6rem;
  color: #fff;
  outline: none;
}
.cal-input-row input:focus { border-color: #4f6ef7; }
.cal-input-row button {
  padding: .5rem 1rem;
  font-size: .8rem;
  font-weight: 600;
  background: #2a2a44;
  color: #ccd;
  border: none;
  border-radius: .6rem;
  cursor: pointer;
  transition: background .15s;
  white-space: nowrap;
}
.cal-input-row button:hover { background: #3a3a55; }
.cal-status {
  font-size: .75rem;
  color: #666688;
  margin-top: .6rem;
  min-height: 1.2em;
}
.cal-status.loading { color: #fbbf24; }
.cal-status.ok { color: #6ee7b7; }
.cal-status.error { color: #f87171; }
.cal-events {
  display: none;
  flex-direction: column;
  gap: .35rem;
  max-height: 260px;
  overflow-y: auto;
  border: 1.5px solid #2a2a44;
  border-top: none;
  border-radius: 0 0 .75rem .75rem;
  padding: .5rem .6rem;
  background: #12121f;
}
.cal-events.open { display: flex; }
.cal-group { margin-top: .5rem; }
.cal-group:first-child { margin-top: 0; }
.cal-group-title {
  font-size: .85rem;
  font-weight: 700;
  color: #f0f0ff;
  text-transform: uppercase;
  letter-spacing: .05em;
  cursor: pointer;
  user-select: none;
  list-style: none;
  padding: .2rem 0;
}
.cal-group-title::-webkit-details-marker { display: none; }
.cal-group-title:hover { color: #ccc; }
.cal-event {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .5rem;
  width: 100%;
  padding: .5rem .7rem;
  font-size: .8rem;
  background: #12121f;
  border: 1.5px solid #2a2a44;
  border-radius: .6rem;
  color: #ddd;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}
.cal-event:hover { background: #1e1e33; border-color: #4f6ef7; }
.cal-event:active { transform: scale(.98); }
.cal-event-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event-time { color: #6ee7b7; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ── step wizard ── */
.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2rem;
}
.step-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #2a2a44;
  color: #666688;
  font-size: .75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}
.step-dot.active { background: #4f6ef7; color: #fff; }
.step-line {
  width: 2.5rem;
  height: 2px;
  background: #2a2a44;
  margin: 0 .3rem;
}
.step-panel { display: block; }
.step-desc {
  font-size: .8rem;
  color: #8888aa;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 1.5rem;
}

.step-footer {
  margin: 1.5rem -2.5rem -3rem;
  border-radius: 0 0 2rem 2rem;
  overflow: hidden;
}
.step-actions {
  display: flex;
}
.step-actions button {
  flex: 1;
  padding: .9rem .2rem;
  font-size: .9rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background .15s;
}
.step-actions button:active { filter: brightness(.85); }

.btn-next { background: #4f6ef7; color: #fff; }
.btn-next:hover { background: #3b5de7; }
.btn-prev { background: #2a2a44; color: #ccd; }
.btn-prev:hover { background: #3a3a55; }
.btn-export {
  display: block;
  width: 100%;
  padding: .75rem;
  font-size: .85rem;
  font-weight: 700;
  border: none;
  background: #22c55e;
  color: #0a0a1a;
  cursor: pointer;
  transition: background .15s;
}
.btn-export:hover { background: #16a34a; }
.btn-export:active { filter: brightness(.85); }

.modal-stop {
  padding: .7rem 2rem;
  font-size: 1rem;
  font-weight: 600;
  background: #ef4444;
  color: #fff;
  border: none;
  border-radius: 2rem;
  cursor: pointer;
  transition: background .15s;
}
.modal-stop:hover { background: #dc2626; }
.modal-stop:active { transform: scale(.95); }

/* ── broadcast list in timer view ── */
.broadcasts-list {
  margin: 0.5rem 0 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.broadcast-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0.6rem;
  font-size: 0.75rem;
  background: #12121f;
  border: 1px solid #2a2a44;
  border-radius: 0.4rem;
  color: #aaa;
  text-decoration: none;
  transition: border-color .15s;
}
.broadcast-item:hover {
  border-color: #4f6ef7;
}
.bc-channel {
  font-weight: 600;
  color: #ddd;
}
.bc-time {
  color: #6ee7b7;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ── calendar event row with expand ── */
.cal-event-wrapper {
  margin-top: 0.35rem;
}
.cal-event-wrapper:first-child {
  margin-top: 0;
}
.cal-event-row {
  display: flex;
  gap: 0.3rem;
  align-items: stretch;
}
.cal-event-row .cal-event {
  flex: 1;
}
.cal-expand {
  width: 2rem;
  min-width: 2rem;
  padding: 0;
  font-size: 1rem;
  font-weight: 700;
  background: #2a2a44;
  border: 1.5px solid #2a2a44;
  border-radius: 0.6rem;
  color: #aaa;
  cursor: pointer;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
}
.cal-expand:hover {
  background: #3a3a55;
  border-color: #4f6ef7;
  color: #fff;
}

/* ── broadcasts within calendar event ── */
.cal-broadcasts {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-top: 0.2rem;
  padding: 0.3rem 0.5rem;
  background: #0d0d18;
  border: 1px solid #2a2a44;
  border-radius: 0.5rem;
}
.cal-broadcast-item {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  padding: 0.15rem 0.3rem;
  color: #999;
  text-decoration: none;
  border-radius: 0.3rem;
  transition: background .15s;
}
.cal-broadcast-item:hover {
  background: #1a1a2e;
}
.cal-broadcast-item .cal-bc-channel {
  font-weight: 600;
  color: #ccc;
}
.cal-broadcast-item .cal-bc-time {
  color: #6ee7b7;
  font-variant-numeric: tabular-nums;
}
