:root {
  color-scheme: dark;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #30271f;
  color: #342f28;
  font-family: "Courier New", Courier, monospace;
}

.typewriter-viewport {
  --stage-width: max(100vw, 133.333333vh);
  --stage-height: max(100vh, 75vw);
  position: relative;
  min-height: 100dvh;
  overflow: hidden;
  background: #30271f;
}

.typewriter-stage {
  position: absolute;
  top: 50%;
  left: 50%;
  width: var(--stage-width);
  height: var(--stage-height);
  transform: translate(-50%, -50%);
}

.typewriter-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.typewriter-key {
  position: absolute;
  z-index: 2;
  display: block;
  min-width: 44px;
  min-height: 44px;
  border-radius: 50%;
  color: transparent;
  text-decoration: none;
}

.typewriter-key--v {
  left: 55.25%;
  top: 77.9%;
  width: 4.8%;
  height: 6.4%;
  transform: translate(-50%, -50%);
}

.typewriter-key:focus-visible {
  outline: 2px solid #8b4333;
  outline-offset: 2px;
}

.paper-search {
  position: absolute;
  top: 8.2%;
  left: 31.18%;
  display: flex;
  width: 29.17%;
  flex-direction: column;
  gap: calc(var(--stage-width) * 0.016667);
  transform: rotate(-8deg);
  transform-origin: center;
  margin: 0;
}

.paper-search__letterhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: calc(var(--stage-width) * 0.010417);
  line-height: normal;
  white-space: nowrap;
}

.paper-search__letterhead p,
.paper-search__hint {
  margin: 0;
}

.paper-search__number,
.paper-search__hint {
  color: #837665;
  font-size: calc(var(--stage-width) * 0.009028);
}

.paper-search__rule {
  width: 100%;
  height: 1px;
  background: #837665;
  opacity: 0.45;
}

.paper-search__entry {
  display: flex;
  width: 100%;
  flex-direction: column;
  gap: calc(var(--stage-width) * 0.011111);
  padding-top: calc(var(--stage-width) * 0.005556);
}

.paper-search__prompt {
  color: #837665;
  font-size: calc(var(--stage-width) * 0.010417);
  line-height: normal;
}

.paper-search__input {
  width: 100%;
  min-width: 0;
  border: 0;
  padding: 0;
  background: transparent;
  color: #342f28;
  caret-color: #8b4333;
  font: inherit;
  font-size: calc(var(--stage-width) * 0.019444);
  line-height: 1.3;
  outline: none;
}

.paper-search__input::placeholder {
  color: #342f28;
  opacity: 1;
}

.paper-search__input:focus::placeholder {
  color: transparent;
  opacity: 0;
}

.paper-search__input::-webkit-search-cancel-button {
  display: none;
}

.paper-search__hint,
.paper-search__note {
  line-height: normal;
}

.paper-search__note {
  margin: 0;
  color: #8b4333;
  font-size: calc(var(--stage-width) * 0.009028);
}

.paper-search__go {
  display: none;
  align-self: flex-start;
  min-height: 44px;
  min-width: 44px;
  margin: 0;
  padding: 0.4rem 0;
  border: 0;
  background: transparent;
  color: #8b4333;
  font: inherit;
  font-size: calc(var(--stage-width) * 0.012);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.input-touch .paper-search__hint {
  display: none;
}

.input-touch .paper-search__go {
  display: inline-flex;
  align-items: center;
}

.input-touch .paper-search__input {
  min-height: 44px;
}

.device-phone .typewriter-viewport {
  --stage-width: max(100vw, 160vh);
  --stage-height: max(100dvh, 62.5vw);
}

.reel {
  min-height: 100dvh;
  display: flex;
  justify-content: center;
  padding:
    calc(1.5rem + var(--safe-top))
    calc(1.25rem + var(--safe-right))
    calc(1.5rem + var(--safe-bottom))
    calc(1.25rem + var(--safe-left));
  background:
    linear-gradient(180deg, rgba(48, 39, 31, 0.2), rgba(48, 39, 31, 0.55)),
    url("assets/typewriter.png") center / cover no-repeat,
    #30271f;
}

.reel-sheet {
  width: min(40rem, 100%);
  margin-top: 8vh;
  padding: 1.5rem 1.35rem 1.25rem;
  background: rgba(236, 226, 206, 0.92);
  color: #342f28;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.reel-sheet__letterhead {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.8rem;
}

.reel-sheet__letterhead p {
  margin: 0;
}

.reel-sheet__letterhead p:last-child {
  color: #837665;
}

.reel-sheet__rule {
  height: 1px;
  margin: 0.8rem 0 1.1rem;
  background: #837665;
  opacity: 0.45;
}

.reel-empty {
  margin: 0 0 1.5rem;
  font-size: 1.35rem;
  line-height: 1.35;
}

.reel-item {
  margin: 0 0 1.5rem;
}

.reel-item figcaption {
  margin-bottom: 0.45rem;
}

.reel-item video {
  display: block;
  width: 100%;
  background: #1b1612;
}

.reel-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
  color: #8b4333;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
