:root {
  --ink: #ecfbff;
  --cyber: #34d5ff;
  --deep: #061423;
  --panel: rgba(5, 16, 28, 0.76);
  --gold: #d4b166;
}

* {
  box-sizing: border-box;
}

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

body {
  color: var(--ink);
  font-family: "Noto Sans JP", "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  background:
    radial-gradient(circle at 50% 20%, rgba(52, 213, 255, 0.24), transparent 20rem),
    linear-gradient(135deg, #020813 0%, #08223a 58%, #03111f 100%);
}

.hologram-shell {
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr;
}

.hologram-header {
  position: relative;
  z-index: 5;
  min-height: 80px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: center;
  padding: 14px clamp(14px, 3vw, 34px);
  border-bottom: 1px solid rgba(52, 213, 255, 0.28);
  background: rgba(3, 12, 22, 0.82);
  backdrop-filter: blur(14px);
}

.return-link,
button,
select,
input {
  font: inherit;
}

.return-link {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid rgba(52, 213, 255, 0.44);
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
  background: rgba(255, 255, 255, 0.06);
}

.hologram-header p,
.hologram-header h1 {
  margin: 0;
}

.hologram-header p {
  color: var(--cyber);
  font-size: 0.78rem;
  font-weight: 800;
}

.hologram-header h1 {
  margin-top: 2px;
  font-family: "Yu Mincho", "Hiragino Mincho ProN", serif;
  font-size: clamp(1.2rem, 3vw, 2rem);
  line-height: 1.25;
}

.hologram-stage {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 82%, rgba(52, 213, 255, 0.3), transparent 22rem),
    repeating-linear-gradient(90deg, rgba(52, 213, 255, 0.1) 0 1px, transparent 1px 42px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.055) 0 1px, transparent 1px 32px);
}

body.is-mobile-hologram .hologram-shell {
  display: block;
}

body.is-mobile-hologram .hologram-header,
body.is-mobile-hologram .hologram-panel,
body.is-mobile-hologram .flow-bar {
  display: none;
}

body.is-mobile-hologram .hologram-stage {
  position: fixed;
  inset: 0;
  z-index: 100;
  height: 100dvh;
}

#hologramCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

#layoutProjectionCanvas {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  background: #000;
}

body.is-layout-projection #layoutProjectionCanvas {
  cursor: zoom-in;
  touch-action: none;
}

#layoutProjectionCanvas[hidden] {
  display: none;
}

body.is-layout-projection #hologramCanvas {
  visibility: hidden;
}

body.is-layout-projection .beam {
  opacity: 0.16;
}

.scan-overlay,
.beam {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.flow-bar {
  position: absolute;
  left: clamp(14px, 3vw, 30px);
  right: clamp(14px, 3vw, 30px);
  top: clamp(14px, 3vw, 30px);
  z-index: 5;
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(0, 1.6fr);
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(52, 213, 255, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(4, 18, 31, 0.86), rgba(7, 32, 47, 0.58)),
    repeating-linear-gradient(135deg, rgba(52, 213, 255, 0.1) 0 1px, transparent 1px 18px);
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.flow-copy span,
.flow-copy strong {
  display: block;
}

.flow-copy span {
  color: var(--cyber);
  font-size: 0.78rem;
  font-weight: 800;
}

.flow-copy strong {
  margin-top: 2px;
  color: #f3fdff;
  font-size: 0.94rem;
  line-height: 1.45;
}

.flow-actions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 8px;
}

.scan-overlay {
  opacity: 0.52;
  background:
    repeating-linear-gradient(0deg, rgba(236, 251, 255, 0.06) 0 1px, transparent 1px 7px),
    linear-gradient(180deg, transparent 0 42%, rgba(52, 213, 255, 0.2) 48%, transparent 55%);
  mix-blend-mode: screen;
  animation: scanMove 3.8s linear infinite;
}

.beam {
  width: 38vw;
  opacity: 0.28;
  background: linear-gradient(90deg, transparent, rgba(52, 213, 255, 0.32), transparent);
  filter: blur(8px);
  transform-origin: bottom center;
}

.beam-left {
  left: 4vw;
  transform: skewX(-18deg);
}

.beam-right {
  right: 4vw;
  transform: skewX(18deg);
}

@keyframes scanMove {
  from {
    background-position: 0 0, 0 -70vh;
  }
  to {
    background-position: 0 0, 0 70vh;
  }
}

.hologram-panel {
  position: absolute;
  right: clamp(14px, 3vw, 30px);
  top: clamp(110px, 15vw, 118px);
  z-index: 4;
  width: min(430px, calc(100% - 28px));
  max-height: calc(100% - 140px);
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(52, 213, 255, 0.36);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(4, 18, 31, 0.9), rgba(7, 32, 47, 0.72)),
    repeating-linear-gradient(135deg, rgba(52, 213, 255, 0.12) 0 1px, transparent 1px 18px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.32), inset 0 0 28px rgba(52, 213, 255, 0.08);
  backdrop-filter: blur(14px);
  overflow: auto;
}

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

.panel-tab {
  min-height: 36px;
  color: rgba(236, 251, 255, 0.82);
  background: rgba(255, 255, 255, 0.07);
}

.panel-tab.is-active {
  color: #04111e;
  background: linear-gradient(90deg, var(--cyber), #e8fff8);
}

.panel-view {
  display: none;
  gap: 12px;
}

.panel-view.is-active {
  display: grid;
}

.panel-view details {
  display: grid;
  gap: 10px;
}

.panel-view summary {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  border: 1px solid rgba(52, 213, 255, 0.28);
  border-radius: 8px;
  color: #e8fbff;
  font-size: 0.88rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.07);
  cursor: pointer;
}

.panel-view details[open] summary {
  margin-bottom: 10px;
}

.panel-kicker {
  margin: 0;
  color: var(--cyber);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hologram-panel h2 {
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.35;
}

.panel-text,
.status {
  margin: 0;
  color: rgba(236, 251, 255, 0.78);
  font-size: 0.9rem;
  line-height: 1.7;
}

.guide-card {
  display: grid;
  gap: 8px;
  margin: 0;
}

.guide-card img {
  display: block;
  width: 100%;
  max-height: 250px;
  object-fit: contain;
  border: 1px solid rgba(52, 213, 255, 0.3);
  border-radius: 8px;
  background: #f8fbff;
}

.guide-card figcaption {
  color: rgba(236, 251, 255, 0.72);
  font-size: 0.78rem;
  line-height: 1.55;
}

.crop-tools,
.advanced-settings {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(52, 213, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
}

.advanced-settings {
  padding: 0;
  border: 0;
  background: transparent;
}

.advanced-settings[open] {
  padding: 12px;
  border: 1px solid rgba(52, 213, 255, 0.24);
  background: rgba(255, 255, 255, 0.045);
}

.section-title-row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.section-title-row h3 {
  margin: 0;
  font-size: 0.96rem;
}

.section-title-row button {
  min-width: 88px;
  min-height: 34px;
}

.crop-tools p {
  margin: 0;
  color: rgba(236, 251, 255, 0.72);
  font-size: 0.78rem;
  line-height: 1.55;
}

.hologram-panel label {
  display: grid;
  gap: 6px;
  color: rgba(236, 251, 255, 0.84);
  font-size: 0.86rem;
  font-weight: 800;
}

.hologram-panel select,
.hologram-panel input[type="range"],
.hologram-panel input[type="number"] {
  width: 100%;
}

.hologram-panel select,
.hologram-panel input[type="number"] {
  min-height: 42px;
  border: 1px solid rgba(52, 213, 255, 0.36);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.08);
}

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

button {
  min-height: 42px;
  border: 1px solid rgba(52, 213, 255, 0.5);
  border-radius: 8px;
  color: #04111e;
  font-weight: 800;
  background: linear-gradient(90deg, var(--cyber), #e8fff8);
  cursor: pointer;
}

.flow-actions button {
  min-height: 40px;
  padding: 6px 10px;
}

.projection-controls {
  position: absolute;
  left: clamp(14px, 3vw, 30px);
  bottom: clamp(14px, 3vw, 30px);
  z-index: 12;
  width: min(520px, calc(100% - 28px));
  display: none;
  grid-template-columns: auto 42px minmax(120px, 1fr) 42px auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border: 1px solid rgba(52, 213, 255, 0.42);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(2, 8, 18, 0.9), rgba(7, 34, 50, 0.72)),
    repeating-linear-gradient(135deg, rgba(52, 213, 255, 0.1) 0 1px, transparent 1px 18px);
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(14px);
}

body.is-layout-projection .projection-controls {
  display: grid;
}

.projection-control-copy span,
.projection-control-copy strong {
  display: block;
  white-space: nowrap;
}

.projection-control-copy span {
  color: var(--cyber);
  font-size: 0.72rem;
  font-weight: 800;
}

.projection-control-copy strong {
  color: #f3fdff;
  font-size: 0.9rem;
}

.projection-controls button {
  min-width: 42px;
  min-height: 38px;
  padding: 0 10px;
}

.projection-controls label {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 8px;
  align-items: center;
  color: rgba(236, 251, 255, 0.86);
  font-size: 0.82rem;
  font-weight: 800;
}

.projection-controls input[type="range"] {
  width: 100%;
  accent-color: var(--cyber);
}

.projection-controls p {
  grid-column: 1 / -1;
  margin: 0;
  color: rgba(236, 251, 255, 0.7);
  font-size: 0.78rem;
  line-height: 1.45;
}

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

.file-controls {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.primary-file-controls {
  grid-template-columns: 1fr;
}

.file-button {
  display: grid;
  place-items: center;
  min-height: 42px;
  border: 1px solid rgba(52, 213, 255, 0.5);
  border-radius: 8px;
  color: #04111e;
  font-weight: 800;
  background: linear-gradient(90deg, var(--cyber), #e8fff8);
  cursor: pointer;
}

.file-button input {
  position: fixed;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

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

#converterPreview {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  border: 1px solid rgba(52, 213, 255, 0.28);
  border-radius: 8px;
  cursor: grab;
  touch-action: none;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 10px, rgba(0, 0, 0, 0.18) 10px 20px),
    #061423;
}

#converterPreview:active {
  cursor: grabbing;
}

.fullscreen-exit {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 120;
  min-width: 116px;
}

.fullscreen-exit[hidden] {
  display: none;
}

button:focus-visible,
select:focus-visible,
input:focus-visible,
.return-link:focus-visible {
  outline: 3px solid rgba(52, 213, 255, 0.58);
  outline-offset: 3px;
}

@media (max-width: 720px) {
  .hologram-header {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .return-link {
    width: max-content;
  }

  .hologram-panel {
    left: 14px;
    right: 14px;
    top: auto;
    bottom: 14px;
    width: auto;
    max-height: 42vh;
    overflow: auto;
  }

  .flow-bar {
    grid-template-columns: 1fr;
    gap: 8px;
    top: 10px;
    left: 10px;
    right: 10px;
    padding: 10px;
  }

  .flow-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .projection-controls,
  body.is-mobile-hologram .projection-controls {
    left: 10px;
    right: 10px;
    bottom: 10px;
    width: auto;
    grid-template-columns: auto 38px minmax(90px, 1fr) 38px;
  }

  .projection-control-copy {
    grid-column: 1 / -1;
  }

  .projection-controls label {
    grid-template-columns: 48px 1fr;
  }

  body.is-mobile-hologram .projection-controls {
    top: 10px;
    bottom: auto;
  }

  #projectionScaleResetButton {
    grid-column: 1 / -1;
  }

  .converter-grid {
    grid-template-columns: 1fr;
  }

  .file-controls,
  .button-row {
    grid-template-columns: 1fr;
  }
}
