:root {
  color-scheme: light;
  font-family: 'Shippori Mincho', 'Yu Mincho', 'Hiragino Mincho ProN', serif;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #ece4d2;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.artwork {
  position: fixed;
  inset: 0;
  overflow: hidden;
  color: #3b352c;
  background: #f4eee0;
}

.artwork canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.artwork__simulation {
  cursor: crosshair;
  touch-action: none;
}

.artwork__grain {
  pointer-events: none;
  mix-blend-mode: multiply;
}

.artwork__title {
  position: absolute;
  z-index: 2;
  top: clamp(22px, 6vh, 46px);
  right: clamp(18px, 5vw, 44px);
  display: flex;
  align-items: center;
  box-sizing: border-box;
  max-width: calc(100vw - 36px);
  min-height: 44px;
  margin: 0;
  padding: 0;
  color: inherit;
  border: 0;
  appearance: none;
  background: transparent;
  font-family: inherit;
  font-size: clamp(20px, 3vh, 30px);
  font-weight: 500;
  letter-spacing: .08em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  touch-action: manipulation;
  animation: ra-fade 2.2s ease .4s both;
}

.artwork__title-inner {
  display: inline-flex;
  align-items: baseline;
  gap: .45em;
  max-width: 100%;
}

.artwork__blank {
  flex: 0 1 3.2em;
  width: 3.2em;
  min-width: 2.4em;
  padding: 0 .08em .08em;
  border-bottom: 2px solid currentColor;
  line-height: 1;
  text-align: center;
}

.artwork__title:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

@keyframes ra-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

html[data-capture-mode='fixed'] .artwork__title {
  animation: none;
}

.controls-panel {
  position: fixed;
  z-index: 20;
  top: 18px;
  left: 18px;
  box-sizing: border-box;
  width: min(340px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  overflow: auto;
  color: #eee9df;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 10px;
  background: rgb(34 32 29 / 88%);
  box-shadow: 0 14px 40px rgb(20 18 16 / 30%);
  font-family: system-ui, sans-serif;
  font-size: 12px;
  backdrop-filter: blur(16px);
}

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

.controls-panel__header {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 14px;
  background: rgb(34 32 29 / 94%);
}

.controls-panel__header h1 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
}

.controls-panel button,
.controls-panel select,
.controls-panel input {
  accent-color: #c67f56;
  font: inherit;
}

.controls-panel button {
  color: inherit;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 5px;
  background: rgb(255 255 255 / 7%);
  cursor: pointer;
}

.controls-panel__close {
  width: 36px;
  height: 36px;
  padding: 0;
}

.controls-panel details {
  border-top: 1px solid rgb(255 255 255 / 10%);
}

.controls-panel summary {
  padding: 11px 14px;
  color: #d8b99f;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .12em;
  text-transform: uppercase;
  cursor: pointer;
}

.control-row {
  display: grid;
  gap: 6px;
  padding: 8px 14px;
}

.control-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.control-heading output {
  color: #bcb5aa;
  font-variant-numeric: tabular-nums;
}

.control-description {
  color: #aaa299;
  font-size: 11px;
  line-height: 1.45;
}

.control-row input[type='range'],
.control-row select,
.control-row input[type='text'] {
  width: 100%;
  box-sizing: border-box;
}

.control-row select,
.control-row input[type='text'] {
  padding: 5px 7px;
  color: #eee9df;
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 4px;
  background: #393632;
}

.control-row--boolean {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.control-row--boolean .control-heading { grid-column: 1; }
.control-row--boolean input { grid-column: 2; grid-row: 1; }
.control-row--boolean .control-description { grid-column: 1 / -1; grid-row: 2; }

.controls-panel :is(button, input, select, summary):focus-visible {
  outline: 2px solid #e2a878;
  outline-offset: 2px;
}

.controls-panel__footer {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  padding: 12px 14px 8px;
  border-top: 1px solid rgb(255 255 255 / 10%);
}

.controls-panel__footer button { padding: 7px 5px; }

.controls-panel__status {
  min-height: 1.4em;
  margin: 0;
  padding: 0 14px 11px;
  color: #cdb9a6;
  text-align: center;
}

body[data-simulation-error='true']::after {
  position: fixed;
  inset: 50% auto auto 50%;
  z-index: 30;
  padding: 12px 16px;
  color: #fff;
  border-radius: 6px;
  background: #8f382c;
  content: 'Simulation initialization failed. Open the console for details.';
  font: 13px system-ui, sans-serif;
  transform: translate(-50%, -50%);
}

@media (prefers-reduced-motion: reduce) {
  .artwork__title {
    animation: none;
  }
}
