:root {
  --top-bar-height: 64px;
  --panel-width: 360px;
  --accent-color: #f35328;
  --page-background: #e8e9e9;
  --page-background-image: none;
  --panel-background: #ffffff;
  --text-color: #2b2b2b;
  --border-color: rgba(43, 43, 43, 0.12);
  --muted-text: rgba(43, 43, 43, 0.62);
  --panel-shadow: -12px 0 28px rgba(43, 43, 43, 0.05);
  --clock-face-background: rgba(236, 236, 236, 1);
  --clock-minute-marker: rgba(43, 43, 43, 0.5);
  --clock-hour-marker: #2d2d2d;
  --clock-number-color: #202020;
  --clock-number-font: "Helvetica Neue", Helvetica, Arial, sans-serif;
  --clock-number-size: 24px;
  --clock-number-weight: 400;
  --clock-hour-hand: #1f1f1f;
  --clock-minute-hand: #2c2c2c;
  --clock-second-hand: #d4151e;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--page-background);
  background-image: var(--page-background-image);
  background-repeat: repeat;
  background-size: auto;
  background-blend-mode: multiply;
  color: var(--text-color);
  font-family: "JetBrains Mono", "Courier New", monospace;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
}

.top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: var(--top-bar-height);
  background: transparent;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
}

.brand__icon {
  display: flex;
  /* width: 14px; */
  /* height: 14px; */
  /* border: 2px solid currentColor; */
  /* border-radius: 50%; */
}

.brand__label,
.customise-button {
  font-size: 14px;
  text-transform: uppercase;
}

.customise-button {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  transition:
    color 140ms ease,
    opacity 140ms ease;
}

.customise-button:hover {
  color: var(--accent-color);
}

.customise-button[aria-expanded="true"] {
  color: var(--accent-color);
}

.customise-button__icon {
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
}

.customise-button__icon-image {
  display: block;
  width: 100%;
  height: 100%;
}

.app-layout {
  position: relative;
  min-height: calc(100vh - var(--top-bar-height));
}

.preview-area {
  padding: 32px;
}

.preview-area {
  min-height: calc(100vh - var(--top-bar-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 56px 56px;
}

.control-panel {
  position: fixed;
  top: calc(var(--top-bar-height));
  right: 16px;
  bottom: 16px;
  z-index: 30;
  width: min(var(--panel-width), calc(100vw - 32px));
  padding: 0;
  border: 1px solid rgba(43, 43, 43, 0.08);
  border-radius: 24px;
  background: var(--panel-background);
  box-shadow:
    0 18px 40px rgba(16, 24, 40, 0.08),
    0 6px 18px rgba(16, 24, 40, 0.04);
  overflow-y: auto;
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
  transform: translateX(0);
  opacity: 1;
}

.app-shell.panel-collapsed .control-panel {
  opacity: 0;
  transform: translateX(24px);
  pointer-events: none;
  border-color: transparent;
  box-shadow: none;
}

.preview-stage {
  width: 100%;
  max-width: 100%;
  display: grid;
  justify-items: center;
  transition: transform 220ms ease;
  transform: translateY(0);
}

.app-shell.style-library-open .preview-stage {
  transform: translateY(-64px);
}

.style-library {
  position: fixed;
  left: 50%;
  bottom: 40px;
  z-index: 35;
  display: grid;
  justify-items: center;
  gap: 18px;
  transform: translateX(-50%);
  pointer-events: none;
}

.style-library__tray {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0;
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
  pointer-events: none;
}

.app-shell.style-library-open .style-library__tray {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.style-library__toggle,
.style-library__arrow {
  border: 0;
  background: #ffffff;
  color: var(--text-color);
  /* box-shadow:
    0 12px 8px rgba(16, 24, 40, 0.08),
    0 4px 3px rgba(16, 24, 40, 0.03); */
}

.style-library__toggle {
  min-width: 120px;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  line-height: 20px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  pointer-events: auto;
}

.style-library__arrow {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  cursor: pointer;
  pointer-events: auto;
  transition:
    transform 140ms ease,
    opacity 140ms ease;
}

.style-library__arrow:hover:not(:disabled) {
  transform: translateY(-1px);
}

.style-library__arrow:disabled {
  opacity: 0.45;
  cursor: default;
}

.style-library__arrow span {
  font-size: 24px;
  line-height: 1;
}

.style-library__slots {
  display: flex;
  align-items: center;
  gap: 18px;
}

.style-library__slot {
  padding: 3px;
  border: 2px solid transparent;
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease;
}

.style-library__slot:hover {
  transform: translateY(-1px);
}

.style-library__slot--selected {
  border-color: var(--accent-color);
}

.style-library__swatch {
  display: grid;
  place-items: center;
  border-radius: 50%;
}

.style-library__swatch--outer {
  width: 64px;
  height: 64px;
}

.style-library__swatch--middle {
  width: 56px;
  height: 56px;
}

.style-library__swatch--inner {
  width: 28px;
  height: 28px;
}

.control-label,
.control-value {
  margin: 0;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.control-value {
  color: var(--muted-text);
}

.clock-frame {
  width: min(74vh, 680px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 30px;
  border-radius: 50%;
}

.clock-face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.clock-face__surface {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--clock-face-background);
}

.clock-markers,
.clock-numbers,
.clock-hands,
.clock-center {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.clock-marker {
  position: absolute;
  inset: 0;
}

.clock-marker__tick {
  position: absolute;
  top: 34px;
  left: 50%;
  width: 2px;
  height: 22px;
  margin-left: -1px;
  border-radius: 999px;
  background: var(--clock-minute-marker);
}

.clock-marker--hour .clock-marker__tick {
  width: 4px;
  height: 36px;
  margin-left: -2px;
  background: var(--clock-hour-marker);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.clock-marker--dot .clock-marker__tick {
  top: 34px;
  left: 50%;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.clock-marker--hour.clock-marker--dot .clock-marker__tick {
  width: 8px;
  height: 8px;
  margin-left: -4px;
  background: var(--clock-hour-marker);
  box-shadow: none;
}

.clock-marker--minute.clock-marker--dot .clock-marker__tick {
  width: 6px;
  height: 6px;
  margin-left: -3px;
  background: var(--clock-minute-marker);
}

.clock-number {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 48px;
  margin-left: -24px;
  margin-top: -24px;
  color: var(--clock-number-color);
  font-family: var(--clock-number-font);
  font-size: var(--clock-number-size);
  font-weight: var(--clock-number-weight);
  line-height: 48px;
  text-align: center;
  transform-origin: center center;
}

.clock-hand {
  position: absolute;
  left: 50%;
  bottom: 50%;
  border-radius: 999px;
  transform-origin: center bottom;
  overflow: hidden;
}

.clock-hand::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -16px;
  width: 100%;
  height: 20px;
  border-radius: inherit;
  transform: translateX(-50%);
}

.clock-hand__lume {
  position: absolute;
  left: 50%;
  bottom: 16px;
  width: 36%;
  height: 58%;
  border-radius: 999px;
  background: #f5f5f5;
  transform: translateX(-50%);
}

.clock-hand__lume--hour {
  width: 42%;
  height: 52%;
}

.clock-hand__lume--minute {
  width: 50%;
  height: 60%;
}

.clock-hand--pointed {
  clip-path: polygon(50% 0, 100% 18%, 100% 100%, 0 100%, 0 18%);
}

.clock-hand--hour {
  width: 12px;
  height: 150px;
  margin-left: -6px;
  background: var(--clock-hour-hand);
  box-shadow: 0 6px 14px rgba(43, 43, 43, 0.16);
  transform: rotate(305deg);
}

.clock-hand--hour::after {
  background: var(--clock-hour-hand);
}

.clock-hand--minute {
  width: 8px;
  height: 220px;
  margin-left: -4px;
  background: var(--clock-minute-hand);
  box-shadow: 0 6px 16px rgba(43, 43, 43, 0.14);
  transform: rotate(32deg);
}

.clock-hand--minute::after {
  background: var(--clock-minute-hand);
}

.clock-hand--second {
  width: 3px;
  height: 238px;
  margin-left: -1.5px;
  background: var(--clock-second-hand);
  box-shadow: 0 4px 12px rgba(212, 21, 30, 0.24);
  transform: rotate(138deg);
}

.clock-hand--second::after {
  width: 3px;
  height: 118px;
  background: var(--clock-second-hand);
}

.clock-center {
  display: grid;
  place-items: center;
}

.clock-center__cap,
.clock-center__pin {
  position: absolute;
  border-radius: 50%;
}

.clock-center__cap {
  width: 28px;
  height: 28px;
  background: radial-gradient(circle at 32% 32%, #5c5c5c 0%, #2b2b2b 36%, #111111 100%);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.14),
    0 6px 12px rgba(43, 43, 43, 0.18);
}

.clock-center__pin {
  width: 10px;
  height: 10px;
  background: #f2f2f2;
  box-shadow: 0 0 0 1px rgba(43, 43, 43, 0.12);
}

.panel-tabs {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 0;
  padding: 24px 20px 0;
  border-bottom: 1px solid rgba(43, 43, 43, 0.08);
}

.panel-tab {
  padding: 0 0 10px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted-text);
  text-transform: uppercase;
  cursor: pointer;
  transition:
    color 140ms ease,
    border-color 140ms ease;
}

.panel-tab:hover {
  color: var(--accent-color);
  background: transparent;
}

.panel-tab--active {
  border-bottom-color: var(--accent-color);
  color: var(--accent-color);
}

.tab-panel {
  display: grid;
  gap: 0;
  margin-top: 0;
  padding: 20px 0 24px;
}

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

.accordion-section {
  border-top: 1px solid rgba(43, 43, 43, 0.08);
}

.accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border: 0;
  background: transparent;
  color: inherit;
  text-transform: uppercase;
  letter-spacing: 0;
  cursor: pointer;
  font-size: 14px;
  line-height: 20px;
}

.accordion-toggle__icon {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  transition: transform 140ms ease;
}

.accordion-section--open .accordion-toggle__icon {
  transform: rotate(180deg);
}

.accordion-toggle__icon-image {
  display: block;
  width: 100%;
  height: 100%;
}

.accordion-content {
  display: grid;
  gap: 0;
  padding: 4px 20px 22px;
}

.accordion-section:not(.accordion-section--open) .accordion-content {
  display: none;
}

.accordion-section:first-child {
  border-top: 0;
}

.control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  min-height: 54px;
  padding: 16px 0;
  border-top: 1px solid rgba(43, 43, 43, 0.08);
}

.control-row:first-child {
  padding-top: 0;
  border-top: 0;
}

.control-label {
  color: var(--text-color);
  line-height: 1.4;
}

.control-value {
  font-size: 11px;
}

.switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch__track {
  position: relative;
  width: 46px;
  height: 26px;
  border-radius: 999px;
  background: rgba(43, 43, 43, 0.14);
  transition: background 120ms ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(43, 43, 43, 0.18);
  transition: transform 120ms ease;
}

.switch input:checked + .switch__track {
  background: var(--accent-color);
}

.switch input:checked + .switch__track::after {
  transform: translateX(20px);
}

.color-input {
  width: 28px;
  height: 28px;
  padding: 2px;
  border: 2px solid rgba(43, 43, 43, 0.15);
  border-radius: 999px;
  background: #ffffff;
  cursor: pointer;
}

.color-input::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input::-webkit-color-swatch {
  border: 0;
  border-radius: 999px;
}

.font-select {
  min-width: 168px;
  padding: 8px 12px;
  border: 1px solid rgba(43, 43, 43, 0.18);
  border-radius: 999px;
  background: #ffffff;
  color: var(--text-color);
}

.range-control {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 184px;
  justify-self: end;
}

.segmented-control {
  display: inline-flex;
  align-items: center;
  justify-self: end;
  padding: 3px;
  border: 1px solid rgba(43, 43, 43, 0.12);
  border-radius: 999px;
  background: rgba(43, 43, 43, 0.04);
}

.segmented-control__option {
  position: relative;
  cursor: pointer;
}

.segmented-control__option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented-control__option span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 102px;
  padding: 8px 12px;
  border-radius: 999px;
  color: var(--muted-text);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition:
    background 140ms ease,
    color 140ms ease;
}

.segmented-control__option input:checked + span {
  background: var(--accent-color);
  color: #ffffff;
}

.range-input {
  width: 100%;
  accent-color: var(--accent-color);
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
}

.range-input::-webkit-slider-runnable-track {
  height: 2px;
  border-radius: 999px;
  background: rgba(43, 43, 43, 0.22);
}

.range-input::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  margin-top: -4px;
  border: 2px solid var(--accent-color);
  border-radius: 50%;
  background: #ffffff;
}

.range-input::-moz-range-track {
  height: 2px;
  border: 0;
  border-radius: 999px;
  background: rgba(43, 43, 43, 0.22);
}

.range-input::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: 2px solid var(--accent-color);
  border-radius: 50%;
  background: #ffffff;
}

.control-placeholder {
  margin: 0;
  color: var(--muted-text);
  line-height: 1.6;
}

.control-label,
.control-value {
  margin: 0;
}

@media (max-width: 1100px) {
  .preview-area {
    padding: 40px 32px;
  }

  .clock-frame {
    width: min(64vw, 560px);
  }

  .clock-hand--hour {
    height: 128px;
  }

  .clock-hand--minute {
    height: 188px;
  }

  .clock-hand--second {
    height: 204px;
  }

  .control-panel {
    width: min(var(--panel-width), calc(100vw - 32px));
  }
}

@media (max-width: 820px) {
  .style-library {
    width: min(calc(100vw - 32px), 520px);
    bottom: 24px;
  }

  .style-library__tray {
    width: 100%;
    gap: 12px;
  }

  .style-library__slots {
    flex: 1;
    justify-content: center;
    gap: 10px;
  }

  .style-library__swatch--outer {
    width: 52px;
    height: 52px;
  }

  .style-library__swatch--middle {
    width: 46px;
    height: 46px;
  }

  .style-library__swatch--inner {
    width: 22px;
    height: 22px;
  }
}
