
:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "Hiragino Kaku Gothic ProN", Meiryo, sans-serif;
  color: #24202c;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #292431;
  --muted: #625a69;
  --accent: #6d3fc0;
  --accent-dark: #5129a0;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-strong: rgba(255, 255, 255, 0.8);
  --line: rgba(63, 48, 77, 0.12);
  --shadow: 0 20px 60px rgba(89, 61, 110, 0.18);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  padding: 32px;
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(109, 63, 192, 0.58);
  outline-offset: 3px;
}

.aurora-background {
  position: fixed;
  inset: -5%;
  z-index: -1;
  background:
    radial-gradient(ellipse 75% 58% at 70% 18%, rgba(175, 109, 255, 0.78), transparent 68%),
    radial-gradient(ellipse 70% 60% at 18% 80%, rgba(255, 115, 177, 0.7), transparent 68%),
    radial-gradient(ellipse 58% 50% at 63% 65%, rgba(255, 231, 173, 0.92), transparent 68%),
    linear-gradient(180deg, #f7eaff 0%, #fde5eb 100%);
  animation: aurora-drift 24s ease-in-out infinite alternate;
}

@keyframes aurora-drift {
  from {
    transform: scale(1);
  }

  to {
    transform: scale(1.06);
  }
}

.page-shell {
  width: min(100%, 980px);
  min-height: calc(100vh - 64px);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.wordmark {
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.home-page {
  justify-content: center;
}

.home-page .site-header {
  position: absolute;
  top: 32px;
  left: max(32px, calc((100vw - 980px) / 2));
  right: max(32px, calc((100vw - 980px) / 2));
  margin-bottom: 0;
}

.intro {
  margin: 64px 0 48px;
  text-align: center;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--accent-dark);
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.18em;
}

.intro h1 {
  margin: 0;
  font-size: clamp(2.15rem, 6vw, 4.2rem);
  line-height: 1.15;
  letter-spacing: -0.055em;
  text-shadow: 0 2px 18px rgba(255, 255, 255, 0.55);
}

.intro-copy {
  margin: 20px 0 0;
  color: #4f4855;
  font-size: clamp(0.98rem, 2.4vw, 1.16rem);
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 28px;
}

.tool-card {
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: clamp(24px, 4vw, 36px);
  border: 1px solid rgba(255, 255, 255, 0.52);
  border-radius: 28px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.tool-card:hover {
  transform: translateY(-5px);
  background: var(--glass-strong);
  box-shadow: 0 26px 64px rgba(89, 61, 110, 0.23);
}

.tool-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  border: 1px solid rgba(109, 63, 192, 0.12);
  border-radius: 19px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
}

.tool-label {
  font-size: clamp(1.35rem, 3vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.tool-description {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.card-action {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: 28px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 800;
}

.card-action span {
  font-size: 1.15em;
  transition: transform 160ms ease;
}

.tool-card:hover .card-action span {
  transform: translate(3px, -2px);
}

.site-footer {
  margin-top: 48px;
  padding: 16px 0;
  color: #5e5664;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-align: center;
}

.site-footer a {
  color: inherit;
  font-weight: 650;
  text-decoration: none;
}

.site-footer a:hover {
  text-decoration: underline;
}

.app-page {
  width: min(100%, 760px);
}

.tool-panel {
  width: min(100%, 620px);
  margin: auto;
  padding: clamp(28px, 5vw, 48px);
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 32px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
}

.panel-heading {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}

.panel-icon {
  width: 54px;
  height: 54px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--accent);
  font-size: 1.8rem;
}

.panel-heading .eyebrow {
  margin-bottom: 6px;
  font-size: 0.64rem;
}

.panel-heading h1 {
  margin: 0;
  font-size: clamp(1.25rem, 4vw, 1.8rem);
  letter-spacing: -0.04em;
}

.timer-display,
.stopwatch-display {
  margin: 40px 0 32px;
  color: #292333;
  font-size: clamp(3.2rem, 14vw, 6.4rem);
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  letter-spacing: -0.075em;
  line-height: 1;
  text-align: center;
}

.stopwatch-display {
  font-size: clamp(2.45rem, 11vw, 5rem);
  letter-spacing: -0.065em;
}

.preset-list {
  width: min(100%, 380px);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-inline: auto;
  margin-bottom: 28px;
}

.preset-button {
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.42);
  color: var(--muted);
  cursor: pointer;
  font-size: 0.81rem;
  font-weight: 700;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.preset-button:hover {
  border-color: rgba(109, 63, 192, 0.36);
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent-dark);
}

.time-inputs {
  width: min(100%, 380px);
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 1fr;
  align-items: end;
  gap: 14px;
  margin: 0 auto 32px;
}

.time-field {
  display: grid;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.time-field input {
  width: 100%;
  min-width: 0;
  min-height: 52px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--ink);
  font-size: 1.2rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

.time-separator {
  padding-bottom: 14px;
  color: var(--muted);
  font-size: 1.2rem;
}

.control-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
}

.control-button {
  min-width: 120px;
  min-height: 50px;
  padding: 12px 24px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.47);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 750;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.control-button:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.82);
}

.primary-button {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 7px 18px rgba(93, 52, 164, 0.2);
}

.primary-button:hover {
  background: var(--accent-dark);
}

.quiet-button {
  color: var(--muted);
}

.control-button[hidden] {
  display: none;
}

.status-message {
  min-height: 1.4em;
  margin: 20px 0 0;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 750;
  text-align: center;
}

.laps-section {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.laps-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.laps-heading h2 {
  margin: 0;
  font-size: 1rem;
  letter-spacing: -0.02em;
}

.lap-count {
  min-width: 26px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
  text-align: center;
}

.lap-list {
  max-height: 240px;
  display: grid;
  gap: 10px;
  overflow: auto;
  margin: 0;
  padding: 0 4px 0 0;
  list-style: none;
}

.empty-laps,
.lap-item {
  min-height: 48px;
  display: grid;
  align-items: center;
  padding: 12px 16px;
  border: 1px solid rgba(63, 48, 77, 0.08);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.4);
}

.empty-laps {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.lap-item {
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
}

.lap-name {
  color: var(--muted);
}

.lap-split {
  color: var(--muted);
  text-align: center;
}

.lap-total {
  text-align: right;
}

.home-page {
  width: min(100%, 820px);
  min-height: calc(100vh - 64px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-inline: auto;
}

.home-header {
  margin-bottom: 36px;
  color: var(--ink);
  font-size: 1.1rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-align: center;
}

.home-page .tool-grid {
  width: min(100%, 760px);
  gap: 20px;
  margin-inline: auto;
}

.home-page .tool-card {
  min-height: 160px;
  width: 100%;
  align-items: center;
  justify-content: center;
  padding: 28px;
  color: var(--ink);
  font-size: clamp(1.05rem, 3.4vw, 1.45rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-align: center;
}

.copyright {
  margin-top: clamp(32px, 7vh, 56px);
  padding: 12px 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.copyright a {
  color: inherit;
}

.app-copyright {
  margin-top: 20px;
  padding: 12px 0 0;
}

.danger-button,
.control-button.is-running {
  border-color: transparent;
  background: #c62828;
  color: #fff;
  box-shadow: 0 7px 18px rgba(151, 34, 34, 0.2);
}

.danger-button:hover,
.control-button.is-running:hover {
  background: #a71919;
}

.control-button:disabled,
.preset-button:disabled,
.time-field input:disabled,
.sound-setting select:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.control-button:disabled {
  background: rgba(90, 83, 98, 0.18);
  color: #706a76;
}

.lap-button:not(:disabled) {
  border-color: transparent;
  background: #2563a6;
  color: #fff;
  box-shadow: 0 7px 18px rgba(37, 99, 166, 0.18);
}

.lap-button:not(:disabled):hover {
  background: #1d4f87;
}

.timer-page .tool-panel {
  position: relative;
  width: min(100%, 560px);
}

.timer-settings {
  position: absolute;
  top: 20px;
  right: 20px;
  z-index: 2;
}

.settings-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--accent-dark);
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease;
}

.settings-button:hover,
.settings-button[aria-expanded="true"] {
  background: #fff;
}

.settings-button .material-symbols-rounded {
  font-size: 23px;
}

.settings-panel {
  position: absolute;
  top: 54px;
  right: 0;
  width: min(320px, calc(100vw - 72px));
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 38px rgba(58, 39, 78, 0.2);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.settings-panel[hidden] {
  display: none;
}

.settings-panel .sound-setting {
  width: 100%;
  margin: 0 0 16px;
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}

.license-card {
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(109, 63, 192, 0.06);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 150ms ease, background 150ms ease;
}

.license-card:hover {
  border-color: rgba(109, 63, 192, 0.35);
  background: rgba(109, 63, 192, 0.1);
}

.license-label {
  grid-column: 1;
  color: var(--muted);
  font-size: 0.67rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.license-title {
  grid-column: 1;
  margin-top: 4px;
  font-size: 0.78rem;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.license-icon {
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--accent-dark);
  font-size: 19px;
}

.tool-title {
  margin: 0;
  padding-inline: 44px;
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  text-align: center;
}

.timer-page .timer-display {
  margin-top: 32px;
}

.timer-page .timer-display.is-units {
  font-size: clamp(1.8rem, 8vw, 3.8rem);
  letter-spacing: -0.04em;
}

.timer-page .time-colon {
  display: inline-block;
  opacity: 1;
}

.timer-page .tool-panel.is-running .time-colon {
  animation: timer-colon-blink 1s steps(1, end) infinite;
}

@keyframes timer-colon-blink {
  50% {
    opacity: 0;
  }
}

.preset-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.timer-page .time-field input:disabled {
  opacity: 0.65;
}

.sound-setting {
  width: min(100%, 320px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 auto 24px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.sound-setting select {
  width: 100%;
  min-width: 132px;
  min-height: 42px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  font: inherit;
}

.timer-page #timer-pause {
  border-color: transparent;
  background: #c62828;
  color: #fff;
  box-shadow: 0 7px 18px rgba(151, 34, 34, 0.2);
}

.timer-page #timer-pause:hover {
  background: #a71919;
}

.timer-page .tool-panel.is-complete {
  border-color: rgba(198, 40, 40, 0.5);
  background: rgba(255, 220, 220, 0.9);
  box-shadow: 0 20px 60px rgba(151, 34, 34, 0.24);
}

.timer-page .tool-panel.is-complete .timer-display {
  color: #b42318;
}

@media (max-width: 600px) {
  body {
    padding: 20px;
  }

  .page-shell {
    min-height: calc(100vh - 40px);
  }

  .home-page .site-header {
    top: 20px;
    left: 20px;
    right: 20px;
  }

  .intro {
    margin: 80px 0 36px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .tool-card {
    min-height: 220px;
    border-radius: 24px;
  }

  .tool-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 20px;
    border-radius: 16px;
  }

  .tool-card .card-action {
    padding-top: 20px;
  }

  .tool-panel {
    border-radius: 26px;
  }

  .control-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
  }

  .control-button {
    min-width: 0;
    padding-inline: 12px;
  }

  .stopwatch-controls .primary-button {
    grid-column: 1 / -1;
  }

  .timer-page .control-row {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

  .timer-page .control-button {
    width: 100%;
    min-height: 50px;
  }

  .timer-page #timer-start,
  .timer-page #timer-pause,
  .timer-page #timer-reset {
    grid-column: auto;
  }

  .home-page {
    min-height: calc(100vh - 40px);
  }

  .home-page .tool-grid {
    grid-template-columns: 1fr;
    width: min(100%, 420px);
    gap: 16px;
  }

  .home-page .tool-card {
    min-height: 120px;
  }
}

@media (max-width: 380px) {
  body {
    padding: 16px;
  }

  .page-shell {
    min-height: calc(100vh - 32px);
  }

  .home-page .site-header {
    top: 16px;
    left: 16px;
    right: 16px;
  }

  .site-header {
    gap: 12px;
    margin-bottom: 20px;
  }

  .wordmark {
    font-size: 0.72rem;
  }

  .tool-panel {
    padding: 24px 18px;
  }

  .home-page {
    min-height: calc(100vh - 32px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
