/*
  TauClock stylesheet
  --------------------
  Emphasizes a dark dashboard aesthetic with clear separation between
  the three core utilities (alarms, timer, stopwatch) rendered as cards.
  The sections below are ordered from global resets down to components.
*/

:root {
  font-family: "Inter", "Hiragino Sans", "Noto Sans JP", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  color: #0c1021;
  background-color: #06080f;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(circle at top, #101a3a 0%, #05070f 55%, #020205 100%);
  color: #f5f7ff;
}

[hidden] {
  display: none !important;
}

/* ---------- Layout scaffolding ---------- */
.app-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: clamp(1.5rem, 4vw, 3rem);
  min-height: 100vh;
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  grid-template-areas:
    "header header header"
    "clock clock clock"
    "alarm timer stopwatch";
  gap: clamp(1rem, 1.8vw, 2.2rem);
  align-items: start;
}

.app-shell > * {
  min-width: 0;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 1rem;
  grid-area: header;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.4rem);
  letter-spacing: 0.06em;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  color: #7ca6ff;
}

.header-meta {
  font-size: 0.85rem;
  color: #b6c5ff;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hint {
  padding: 0.25rem 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
}

.hint-button {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #b6c5ff;
  cursor: pointer;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
}

.hint-button:hover {
  background: rgba(17, 30, 72, 0.35);
}

.clock-grid {
  grid-area: clock;
  display: grid;
  grid-template-columns: minmax(340px, 1.5fr) minmax(220px, 1fr);
  gap: 1.5rem;
  align-items: stretch;
}

/* Clock cards for local/UTC displays */
.clock-card {
  border: 1px solid rgba(255, 255, 255, 0.14);
  padding: 1.75rem;
  border-radius: 1.5rem;
  background: linear-gradient(135deg, rgba(13, 19, 45, 0.85), rgba(4, 8, 20, 0.9));
  box-shadow: 0 25px 60px rgba(2, 3, 8, 0.55);
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.3rem;
}

.clock-card-main {
  background: linear-gradient(135deg, rgba(69, 119, 255, 0.2), rgba(10, 15, 30, 0.95));
  border-color: rgba(124, 166, 255, 0.4);
}

.clock-card-aux {
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(7, 12, 30, 0.85), rgba(3, 5, 13, 0.9));
  border-color: rgba(255, 255, 255, 0.1);
  opacity: 0.95;
}

#alarm-panel {
  grid-area: alarm;
}

/* Map panel IDs to grid regions */
#timer-panel {
  grid-area: timer;
}

#stopwatch-panel {
  grid-area: stopwatch;
}

.clock-card h2 {
  margin: 0 0 0.7rem 0;
  font-size: 1rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #9ab3ff;
}

.clock-time {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.clock-card-aux .clock-time {
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  color: #d3dcff;
}

.clock-card-aux .clock-date {
  font-size: 0.85rem;
  opacity: 0.85;
}

.clock-date {
  margin: 0.25rem 0 0;
  color: #d0ddff;
  letter-spacing: 0.05em;
}

/* Shared card styling for alarm/timer/stopwatch widgets */
.panel {
  background: rgba(6, 9, 23, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  height: 100%;
}

.panel header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.panel h2 {
  margin: 0;
  font-size: 1.4rem;
}

.panel-hint {
  margin: 0;
  color: #8ca4ff;
  font-size: 0.85rem;
}

/* Form controls */
.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
  align-items: end;
}

label span {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.2rem;
  color: #9fb7ff;
}

input,
select {
  font: inherit;
  padding: 0.65rem 0.85rem;
  border-radius: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(6, 12, 33, 0.8);
  color: #f4f7ff;
  width: 100%;
}

button,
select,
input {
  font: inherit;
}

input:focus,
button:focus,
select:focus {
  outline: 2px solid #7aa8ff;
  outline-offset: 2px;
}

button {
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
  text-align: center;
  background: rgba(6, 12, 33, 0.8);
  border-radius: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f4f7ff;
  padding: 0.65rem 0.85rem;
  width: auto;
}

button:hover {
  background: rgba(17, 30, 72, 0.9);
}

button:active {
  transform: translateY(1px);
}

button.ghost {
  width: auto;
  border-radius: 999px;
}

.next-indicator {
  font-size: 0.9rem;
  color: #d9e1ff;
  margin: 0;
}

/* Alarm/timer list styling */
.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.item-list li {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 1rem;
  padding: 0.8rem 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  background: rgba(9, 12, 34, 0.8);
}

.item-list li.muted {
  opacity: 0.55;
}

.item-list li.ringing {
  border-color: #ff8f6c;
  box-shadow: 0 0 12px rgba(255, 143, 108, 0.5);
  animation: pulse 1s infinite;
}

.item-list li small {
  display: block;
  font-size: 0.75rem;
  color: #8ea1d7;
}

.item-list.compact li {
  flex-direction: column;
  align-items: flex-start;
}

.alarm-actions {
  display: flex;
  gap: 0.4rem;
}

.badge {
  padding: 0.25rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(123, 200, 255, 0.15);
  border: 1px solid rgba(123, 200, 255, 0.35);
}

/* Large numeric readouts for timer/stopwatch */
.big-time {
  font-size: clamp(2rem, 5vw, 3rem);
  font-variant-numeric: tabular-nums;
  text-align: center;
  padding: 1rem;
  border-radius: 1.2rem;
  background: rgba(7, 12, 29, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.button-row button {
  flex: 1;
}

.inline-form button {
  width: 100%;
}

.status-text {
  min-height: 1rem;
  margin: 0;
  font-size: 0.85rem;
  color: #9fb7ff;
}

.duration-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

/* Toast-like status label pinned near the bottom of the viewport */
#status-message {
  position: fixed;
  bottom: 1.2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f7fbff;
  padding: 0.5rem 1.2rem;
  border-radius: 999px;
  font-size: 0.9rem;
  pointer-events: none;
  min-width: 200px;
  text-align: center;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
  100% {
    transform: scale(1);
  }
}

/* Keyboard shortcut/About modal overlay */
.shortcut-overlay,
.about-overlay {
  position: fixed;
  inset: 0;
  backdrop-filter: blur(8px);
  background: rgba(2, 4, 12, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.shortcut-card,
.about-card {
  width: min(520px, 80vw);
  background: rgba(4, 8, 24, 0.92);
  border-radius: 1.5rem;
  padding: 1.25rem 1.5rem 1.5rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 70px rgba(0, 0, 0, 0.55);
}

.shortcut-card header,
.about-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.shortcut-card dl {
  margin: 1rem 0 0;
  display: grid;
  grid-template-columns: minmax(90px, 1fr) 3fr;
  gap: 0.35rem 0.75rem;
  font-size: 0.95rem;
}

.shortcut-card dt {
  font-weight: 600;
  color: #9dc0ff;
}

.shortcut-card dd {
  margin: 0;
  color: #e5ebff;
}

.about-card {
  width: min(760px, 92vw);
  max-height: min(84vh, 780px);
  overflow: auto;
}

.about-meta {
  margin: 1rem 0;
  display: grid;
  grid-template-columns: minmax(120px, 180px) 1fr;
  gap: 0.3rem 0.75rem;
}

.about-meta dt {
  color: #9dc0ff;
  font-weight: 600;
}

.about-meta dd {
  margin: 0;
  color: #e5ebff;
  overflow-wrap: anywhere;
}

.about-card h3 {
  margin: 0.6rem 0 0.45rem;
  font-size: 0.95rem;
  color: #9dc0ff;
}

.about-license {
  margin: 0;
  padding: 1rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(1, 3, 11, 0.8);
  color: #d9e5ff;
  line-height: 1.45;
  white-space: pre-wrap;
  font-size: 0.84rem;
}

/* Responsive adjustments for tablet/phone layouts */
@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: repeat(2, minmax(260px, 1fr));
    grid-template-areas:
      "header header"
      "clock clock"
      "alarm timer"
      "stopwatch stopwatch";
  }
}

@media (max-width: 860px) {
  .clock-grid {
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  }

  .app-shell {
    grid-template-columns: 1fr;
    grid-template-areas:
      "header"
      "clock"
      "alarm"
      "timer"
      "stopwatch";
  }
}

@media (max-width: 640px) {
  .inline-form {
    grid-template-columns: 1fr;
  }

  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .shortcut-card dl {
    grid-template-columns: 1fr;
  }

  .about-meta {
    grid-template-columns: 1fr;
  }
}
