:root {
  --button-top: #d6dce4;
  --button-mid: #aeb8c6;
  --button-bottom: #778292;
  --button-border-dark: #323947;
  --button-border-light: #f9fbff;
  --text: #203247;
  --panel: rgba(248, 252, 255, 0.9);
  --line: rgba(84, 113, 143, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  font-family: "Yu Gothic", "Meiryo", "Hiragino Kaku Gothic ProN", sans-serif;
  color: var(--text);
  background: #eef6ff;
}

.screen {
  position: relative;
  display: none;
  grid-template-rows: minmax(120px, 26vh) auto 1fr;
  min-height: 100vh;
  padding: 28px 18px;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.16), rgba(225, 241, 255, 0.28)),
    url("assets/logic-bg.png") center / cover no-repeat;
}

.screen.active {
  display: grid;
}

.screen::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  background:
    radial-gradient(circle at center 18%, rgba(255, 255, 255, 0.78), transparent 34%),
    linear-gradient(180deg, transparent 62%, rgba(222, 239, 255, 0.35));
}

.logo,
.menu,
.page-header,
.library-panel,
.play-layout {
  position: relative;
  z-index: 1;
}

.logo {
  align-self: end;
  max-width: calc(100vw - 36px);
  margin: 0 auto;
  text-align: center;
  font-size: clamp(42px, 7vw, 96px);
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: 0;
  color: #f7fbff;
  -webkit-text-stroke: clamp(2px, 0.45vw, 6px) #566d89;
  text-shadow:
    0 5px 0 #8fa4bd,
    0 10px 0 #576c85,
    0 16px 22px rgba(67, 105, 145, 0.28);
}

.menu {
  display: grid;
  gap: 10px;
  width: min(520px, calc(100vw - 32px));
  margin: 44px auto 0;
}

.menu button {
  min-height: 48px;
  padding: 9px 18px 10px;
  border: 2px solid var(--button-border-dark);
  border-top-color: var(--button-border-light);
  border-left-color: var(--button-border-light);
  border-radius: 0;
  color: #243348;
  font: 700 18px/1.2 "Yu Gothic", "Meiryo", sans-serif;
  letter-spacing: 0;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 44%),
    linear-gradient(180deg, var(--button-top), var(--button-mid) 48%, var(--button-bottom));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 3px 0 rgba(61, 73, 91, 0.82),
    0 8px 18px rgba(101, 139, 176, 0.22);
}

.menu button:hover,
.menu button:focus-visible {
  color: #143a66;
  outline: 3px solid rgba(117, 174, 235, 0.42);
  outline-offset: 2px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.32), transparent 42%),
    linear-gradient(180deg, #e3eaf1, #b9c5d2 48%, #8391a3);
}

.menu button:active {
  transform: translateY(2px);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.34),
    0 1px 0 rgba(61, 73, 91, 0.82),
    0 4px 12px rgba(101, 139, 176, 0.2);
}

.menu button:disabled,
.menu button.shutdown-disabled {
  opacity: 0.48;
  filter: grayscale(1);
  cursor: not-allowed;
  transform: none;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 1px 0 rgba(61, 73, 91, 0.62);
}

.shutdown-countdown {
  margin: 2px 0;
  padding: 10px 12px;
  border: 2px solid rgba(86, 109, 137, 0.52);
  color: #16304d;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  background: rgba(248, 252, 255, 0.92);
}

.shutdown-countdown[hidden] {
  display: none;
}

.shutdown-banner {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 80;
  width: 100%;
  padding: 8px 12px;
  color: #ffffff;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.3;
  text-align: center;
  background: rgba(35, 55, 78, 0.9);
  box-shadow: 0 4px 14px rgba(20, 38, 58, 0.24);
}

.shutdown-banner[hidden] {
  display: none;
}

.notice-banner {
  position: fixed;
  left: 0;
  z-index: 79;
  width: 100%;
  min-height: 36px;
  padding: 8px 14px;
  overflow: hidden;
  color: #16304d;
  font-size: 15px;
  font-weight: 900;
  line-height: 1.35;
  text-align: center;
  white-space: nowrap;
  background: rgba(248, 252, 255, 0.92);
  border-bottom: 1px solid rgba(76, 99, 125, 0.24);
  box-shadow: 0 4px 14px rgba(20, 38, 58, 0.14);
}

.notice-banner span {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
}

.notice-banner.scrolling span {
  max-width: none;
  min-width: max-content;
  padding-inline: 32px;
  animation: notice-marquee 18s linear infinite;
}

.notice-banner[hidden] {
  display: none;
}

@keyframes notice-marquee {
  from {
    transform: translateX(100vw);
  }
  to {
    transform: translateX(-100%);
  }
}

.library-view,
.single-view,
.play-view {
  grid-template-rows: auto 1fr;
  gap: 24px;
  overflow: auto;
}

.page-header {
  display: grid;
  grid-template-columns: 112px 1fr 112px;
  align-items: center;
  gap: 12px;
  width: min(1100px, calc(100vw - 32px));
  margin: 0 auto;
}

.page-header h1 {
  margin: 0;
  text-align: center;
  font-size: clamp(34px, 5vw, 64px);
  font-weight: 900;
  line-height: 1;
  color: #f7fbff;
  -webkit-text-stroke: 3px #566d89;
  text-shadow:
    0 4px 0 #8fa4bd,
    0 8px 0 #576c85,
    0 12px 18px rgba(67, 105, 145, 0.26);
}

.pixel-button {
  min-height: 42px;
  padding: 8px 14px;
  border: 2px solid var(--button-border-dark);
  border-top-color: var(--button-border-light);
  border-left-color: var(--button-border-light);
  border-radius: 0;
  color: #243348;
  font: 700 15px/1.2 "Yu Gothic", "Meiryo", sans-serif;
  text-align: center;
  text-decoration: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.72);
  cursor: pointer;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.24), transparent 44%),
    linear-gradient(180deg, var(--button-top), var(--button-mid) 48%, var(--button-bottom));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.42),
    0 3px 0 rgba(61, 73, 91, 0.82);
}

.pixel-button.primary {
  color: #153452;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 44%),
    linear-gradient(180deg, #dff2ff, #9fc9ec 48%, #5f92c4);
}

.pixel-button:disabled {
  color: #69798a;
  cursor: not-allowed;
  filter: grayscale(0.35);
  opacity: 0.62;
}

.pixel-button.small {
  min-height: 38px;
  padding-inline: 10px;
}

.library-panel {
  width: min(1100px, calc(100vw - 32px));
  min-height: 55vh;
  margin: 0 auto;
  padding: 18px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(91, 130, 171, 0.18);
}

.storage-panel {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
  padding: 12px;
  border: 1px solid rgba(76, 99, 125, 0.24);
  background: rgba(255, 255, 255, 0.72);
}

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

.storage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #39516c;
}

.storage-head strong {
  font-size: 15px;
}

.storage-bar {
  display: flex;
  overflow: hidden;
  height: 18px;
  border: 1px solid rgba(76, 99, 125, 0.32);
  background: #eef6fc;
}

.storage-segment {
  min-width: 0;
  transition: width 0.2s ease;
}

.storage-segment.image,
.storage-legend i.image {
  background: #4d82b4;
}

.storage-segment.system,
.storage-legend i.system {
  background: #7d8fa3;
}

.storage-segment.free,
.storage-legend i.free {
  background: #dcecf9;
}

.storage-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  color: #52677f;
  font-size: 12px;
  font-weight: 800;
}

.storage-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.storage-legend i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid rgba(76, 99, 125, 0.24);
}

.storage-legend b {
  color: #203247;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.compact-title {
  padding-bottom: 8px;
}

.compact-title h2 {
  font-size: 16px;
}

.section-title h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.25;
}

.section-title span {
  flex: 0 0 auto;
  font-weight: 700;
  color: #527092;
}

.logic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.logic-card {
  position: relative;
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
}

.card-image-wrap {
  position: relative;
}

.logic-card img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid rgba(83, 112, 142, 0.22);
  background: #eaf3fc;
}

.progress-only-card .card-image-wrap {
  aspect-ratio: 4 / 3;
  border: 1px solid rgba(83, 112, 142, 0.22);
  background: #ffffff;
}

.progress-only-card img {
  display: none;
}

.card-progress-mini {
  position: absolute;
  left: var(--card-mini-left, 0);
  top: var(--card-mini-top, 0);
  display: grid;
  width: var(--card-mini-width, 100%);
  height: var(--card-mini-height, 100%);
  max-height: var(--card-mini-max-height, none);
  aspect-ratio: var(--card-mini-cols, 1) / var(--card-mini-rows, 1);
  overflow: hidden;
  border: var(--card-mini-border, 0);
  background: var(--card-mini-background, #ffffff);
  box-shadow: var(--card-mini-shadow, none);
  pointer-events: none;
}

.card-progress-mini i {
  border-right: 1px solid rgba(158, 181, 206, 0.45);
  border-bottom: 1px solid rgba(158, 181, 206, 0.45);
  background: #ffffff;
}

.card-progress-mini i.painted {
  background: rgba(32, 50, 71, 0.94);
}

.favorite-button,
.kebab-button {
  position: absolute;
  top: 7px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(76, 99, 125, 0.55);
  color: #243348;
  font: 900 20px/1 sans-serif;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.9);
}

.favorite-button {
  left: 7px;
}

.favorite-button.active {
  color: #be8a00;
}

.kebab-button {
  right: 7px;
}

.card-play-button {
  position: absolute;
  right: 7px;
  bottom: 7px;
  min-width: 72px;
}

.card-menu-wrap {
  position: absolute;
  top: 7px;
  right: 7px;
}

.card-menu {
  position: absolute;
  top: 39px;
  right: 0;
  display: grid;
  min-width: 180px;
  padding: 5px;
  border: 1px solid rgba(76, 99, 125, 0.55);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 10px 20px rgba(42, 64, 88, 0.18);
  z-index: 4;
}

.card-menu[hidden] {
  display: none;
}

.card-menu button {
  min-height: 36px;
  border: 0;
  color: #203247;
  font: 700 13px/1.2 "Yu Gothic", "Meiryo", sans-serif;
  text-align: left;
  cursor: pointer;
  background: transparent;
}

.card-menu button:hover,
.card-menu button:focus-visible {
  background: #e9f4ff;
}

.logic-info {
  display: grid;
  gap: 4px;
}

.logic-info strong {
  font-size: 16px;
}

.logic-info span,
.logic-info time {
  color: #52677f;
  font-size: 13px;
}

.status-row,
.filter-bar,
.type-tabs,
.grid-size-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill,
.size-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid rgba(82, 103, 127, 0.24);
  color: #39516c;
  font-size: 12px;
  font-weight: 800;
  background: #edf5fd;
}

.status-select {
  max-width: 112px;
  padding-right: 24px;
  font-family: inherit;
  cursor: pointer;
  appearance: auto;
}

.status-select:disabled {
  opacity: 0.72;
  cursor: wait;
}

.status-pill[data-status="playing"] {
  color: #7c5700;
  background: #fff3cf;
}

.status-pill[data-status="cleared"] {
  color: #1f6b48;
  background: #dcf5e8;
}

.filter-bar {
  margin-top: 14px;
}

.filter-bar select,
.filter-bar input,
.field select {
  min-height: 38px;
  padding: 7px 10px;
  border: 1px solid rgba(76, 99, 125, 0.58);
  color: #203247;
  font: 700 14px/1.2 "Yu Gothic", "Meiryo", sans-serif;
  background: rgba(255, 255, 255, 0.94);
}

.filter-bar input {
  width: 92px;
}

.type-tabs {
  margin-top: 16px;
}

.empty-message {
  margin: 34px 0 0;
  text-align: center;
  color: #52677f;
  font-weight: 700;
}

.register-dialog {
  width: min(980px, calc(100vw - 24px));
  max-height: min(760px, calc(100vh - 24px));
  padding: 0;
  border: 1px solid rgba(62, 82, 105, 0.62);
  background: transparent;
}

.register-dialog::backdrop {
  background: rgba(28, 48, 72, 0.46);
}

.dialog-card {
  display: grid;
  gap: 16px;
  max-height: inherit;
  padding: 18px;
  overflow: auto;
  background:
    linear-gradient(rgba(255, 255, 255, 0.88), rgba(238, 247, 255, 0.94)),
    url("assets/logic-bg.png") center / cover no-repeat;
}

.dialog-head,
.dialog-actions,
.camera-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dialog-head {
  justify-content: space-between;
}

.dialog-head h2 {
  margin: 0;
  font-size: 24px;
}

.icon-close {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(76, 99, 125, 0.55);
  color: #243348;
  font: 900 24px/1 sans-serif;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.78);
}

.type-choices {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.choice {
  min-height: 58px;
  padding: 9px 10px;
  border: 2px solid rgba(76, 99, 125, 0.72);
  color: #243348;
  font: 800 15px/1.25 "Yu Gothic", "Meiryo", sans-serif;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.78);
}

.choice.selected {
  border-color: #3d78b8;
  color: #113a62;
  background: #dff1ff;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.field {
  display: grid;
  gap: 6px;
  font-weight: 700;
}

.field input,
.field textarea,
.field select {
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid rgba(76, 99, 125, 0.58);
  color: #203247;
  font: 16px/1.3 "Yu Gothic", "Meiryo", sans-serif;
  background: rgba(255, 255, 255, 0.9);
}

.field textarea {
  min-height: 86px;
  resize: vertical;
}

.issue-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr minmax(180px, 1.6fr);
  gap: 10px;
  align-items: end;
}

.year-input-wrap {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding-inline: 10px;
  border: 1px solid rgba(76, 99, 125, 0.58);
  background: rgba(255, 255, 255, 0.9);
}

.year-input-wrap input {
  min-height: 30px;
  padding: 3px 4px;
  border: 0;
  text-align: center;
  background: transparent;
}

.year-input-wrap span,
.year-input-wrap small {
  color: #52677f;
  font-weight: 900;
}

.generated-title input {
  background: rgba(232, 242, 252, 0.92);
}

.legacy-ocr {
  display: none !important;
}

.hint-register-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.hint-image-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.hint-source-actions {
  display: flex;
  justify-content: flex-end;
}

.hint-image-panel {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(76, 99, 125, 0.22);
  background: rgba(255, 255, 255, 0.72);
}

.hint-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hint-panel-head strong {
  color: #39516c;
}

.hint-adjuster {
  display: grid;
  gap: 10px;
}

.hint-adjuster[hidden] {
  display: none;
}

.hint-stage {
  position: relative;
  overflow: hidden;
  min-height: 0;
  border: 1px solid rgba(76, 99, 125, 0.32);
  background: #edf5fc;
  touch-action: none;
}

.hint-stage img {
  display: block;
  width: 100%;
  height: auto;
}

.hint-guide-lines,
.hint-crop-box {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.hint-guide-lines {
  pointer-events: auto;
}

.hint-guide-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.hint-guide-svg .hint-grid-line {
  position: absolute;
  stroke: rgba(32, 92, 150, 0.45);
  stroke-linecap: round;
  stroke-width: 0.24;
  cursor: grab;
  pointer-events: stroke;
}

.hint-guide-svg .hint-grid-line.selected,
.hint-guide-svg .hint-grid-line.dragging {
  stroke: rgba(230, 41, 41, 0.72);
  stroke-width: 0.48;
}

.hint-guide-svg .hint-grid-line.multi-selected {
  stroke: rgba(230, 41, 41, 0.68);
  stroke-width: 0.42;
}

.hint-guide-svg .hint-guide-point {
  fill: #ffffff;
  stroke: rgba(32, 92, 150, 0.82);
  stroke-width: 0.24;
  cursor: grab;
  pointer-events: fill;
}

.hint-guide-svg .hint-guide-point.selected,
.hint-guide-svg .hint-guide-point.multi-selected {
  fill: #fff8d8;
  stroke: rgba(230, 41, 41, 0.82);
  stroke-width: 0.34;
}

.hint-guide-svg .hint-edge-line {
  stroke: rgba(230, 41, 41, 0.5);
  stroke-linecap: round;
  stroke-width: 0.38;
  cursor: copy;
  pointer-events: stroke;
}

.hint-guide-svg .hint-edge-line.shared-frame {
  stroke: rgba(230, 41, 41, 0.28);
  cursor: default;
  pointer-events: none;
}

.hint-guide-svg .hint-edge-point {
  fill: #ffffff;
  stroke: rgba(230, 41, 41, 0.72);
  stroke-width: 0.28;
  cursor: grab;
  pointer-events: fill;
}

.hint-guide-svg .hint-edge-point.shared-frame {
  fill: rgba(255, 255, 255, 0.7);
  stroke: rgba(230, 41, 41, 0.36);
  cursor: default;
  pointer-events: none;
}

.hint-crop-box {
  background: rgba(46, 139, 87, 0.08);
  box-shadow:
    0 0 0 9999px rgba(15, 31, 49, 0.22),
    inset 0 0 0 1px rgba(255, 255, 255, 0.78);
}

.hint-corner {
  position: absolute;
  z-index: 3;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 4px solid #ffffff;
  border-radius: 50%;
  cursor: grab;
  transform: translate(-50%, -50%);
  background: rgba(46, 139, 87, 0.2);
  box-shadow:
    0 2px 12px rgba(31, 69, 106, 0.42),
    inset 0 0 0 2px rgba(255, 255, 255, 0.38);
  touch-action: none;
  transition:
    width 120ms ease,
    height 120ms ease,
    background-color 120ms ease,
    box-shadow 120ms ease;
}

.hint-corner::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 15px;
  border-radius: 99px;
  background: #e62929;
  pointer-events: none;
  transform: translateX(-50%);
}

.hint-corner::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 3px;
  border-radius: 99px;
  background: #e62929;
  pointer-events: none;
  transform: translateY(-50%);
}

.hint-corner[data-hint-corner$="-tr"]::before,
.hint-corner[data-hint-corner$="-br"]::before {
  transform: translate(-100%, -50%);
}

.hint-corner[data-hint-corner$="-br"]::after,
.hint-corner[data-hint-corner$="-bl"]::after {
  transform: translate(-50%, -100%);
}

.hint-corner.selected {
  z-index: 5;
  width: 48px;
  height: 48px;
  border-color: rgba(255, 255, 255, 0.98);
  background: rgba(230, 41, 41, 0.16);
  box-shadow:
    0 4px 18px rgba(31, 69, 106, 0.5),
    0 0 0 4px rgba(255, 255, 255, 0.26),
    inset 0 0 0 2px rgba(255, 255, 255, 0.36);
}

.hint-corner.dragging {
  z-index: 8;
  width: 68px;
  height: 68px;
  border-color: rgba(255, 255, 255, 1);
  background: rgba(230, 41, 41, 0.12);
  box-shadow:
    0 8px 26px rgba(18, 42, 66, 0.58),
    0 0 0 5px rgba(255, 255, 255, 0.34),
    inset 0 0 0 3px rgba(255, 255, 255, 0.42);
}

.hint-corner:active {
  cursor: grabbing;
}

.hint-loupe {
  position: absolute;
  z-index: 7;
  width: 168px;
  height: 168px;
  overflow: hidden;
  border: 4px solid rgba(255, 255, 255, 0.96);
  border-radius: 50%;
  background: #ffffff;
  box-shadow:
    0 10px 28px rgba(13, 28, 46, 0.42),
    0 0 0 1px rgba(32, 63, 94, 0.28);
  pointer-events: none;
}

.hint-loupe[hidden] {
  display: none;
}

.hint-loupe img {
  position: absolute;
  z-index: 1;
  display: block;
  max-width: none;
  width: auto;
  height: auto;
  pointer-events: none;
}

.hint-loupe::after {
  content: "";
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 42px;
  border-radius: 99px;
  background: #e62929;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.82);
  transform: translateX(-50%);
}

.hint-loupe::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: 50%;
  top: 50%;
  width: 42px;
  height: 3px;
  border-radius: 99px;
  background: #e62929;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.82);
  transform: translateY(-50%);
}

.hint-loupe.corner-tr::before,
.hint-loupe.corner-br::before {
  transform: translate(-100%, -50%);
}

.hint-loupe.corner-br::after,
.hint-loupe.corner-bl::after {
  transform: translate(-50%, -100%);
}

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

.hint-controls label {
  display: grid;
  gap: 4px;
  color: #52677f;
  font-size: 12px;
  font-weight: 900;
}

.register-size-fields {
  align-items: stretch;
}

.color-register-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid rgba(76, 99, 125, 0.28);
  background: rgba(239, 247, 255, 0.72);
}

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

.color-actions {
  display: grid;
  grid-template-columns: auto minmax(92px, 120px) minmax(120px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.manual-color-field,
.manual-color-name {
  display: grid;
  gap: 4px;
  color: #39516c;
  font-size: 12px;
  font-weight: 900;
}

.manual-color-field input[type="color"] {
  width: 100%;
  height: 38px;
  padding: 2px;
}

.color-palette-list,
.recent-color-list,
.color-tool-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.color-chip,
.color-tool-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 8px;
  border: 1px solid rgba(38, 58, 78, 0.34);
  color: var(--swatch-text, #ffffff);
  font-size: 12px;
  font-weight: 900;
  background: var(--swatch, #203247);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.24);
}

.color-chip button {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.62);
  color: inherit;
  font-weight: 900;
  background: rgba(0, 0, 0, 0.18);
  cursor: pointer;
}

.color-tool-button.selected {
  outline: 3px solid #111827;
  outline-offset: 2px;
}

.recent-colors {
  display: grid;
  gap: 6px;
  color: #39516c;
  font-size: 12px;
  font-weight: 900;
}

.number-net-register-panel {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(82, 103, 127, 0.24);
  background: rgba(239, 247, 255, 0.72);
}

.number-net-register-panel[hidden] {
  display: none;
}

.number-net-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
}

.compact-field {
  max-width: 120px;
}

.number-net-board-wrap {
  max-height: 360px;
  overflow: auto;
  border: 1px solid rgba(82, 103, 127, 0.28);
  background: #ffffff;
}

.number-net-board {
  display: grid;
  width: max-content;
  min-width: 100%;
  background-color: #ffffff;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.number-net-register-cell {
  min-width: 22px;
  min-height: 22px;
  border: 0;
  border-right: 1px solid rgba(224, 48, 48, 0.32);
  border-bottom: 1px solid rgba(224, 48, 48, 0.32);
  color: rgba(0, 76, 190, 0.9);
  font-weight: 900;
  background: rgba(255, 255, 255, 0.54);
  cursor: pointer;
}

.number-net-board.has-board-image .number-net-register-cell {
  background: rgba(255, 255, 255, 0.18);
}

.number-net-board.has-board-image .number-net-register-cell.has-number {
  background: rgba(230, 242, 255, 0.74);
}

.number-net-register-cell.thick-right {
  border-right-width: 2px;
  border-right-color: rgba(224, 48, 48, 0.72);
}

.number-net-register-cell.thick-bottom {
  border-bottom-width: 2px;
  border-bottom-color: rgba(224, 48, 48, 0.72);
}

.range-empty.warning {
  color: #ba2930;
}

.color-pick-active .hint-stage {
  cursor: crosshair;
}

.register-preview {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid rgba(76, 99, 125, 0.22);
  background: rgba(255, 255, 255, 0.76);
}

.register-preview[hidden] {
  display: none;
}

.preview-board-scroll {
  overflow: auto;
  max-height: 430px;
  border: 1px solid rgba(82, 103, 127, 0.28);
  background: #d8e6f2;
}

.preview-board {
  display: grid;
  width: max-content;
  min-width: 100%;
  --preview-cell-size: 20px;
  --preview-top-height: 120px;
  --preview-left-width: 120px;
  background: #9eb5ce;
}

.preview-board .preview-corner,
.preview-board .preview-top-image,
.preview-board .preview-left-image,
.preview-board .preview-cell {
  border-right: 1px solid #9eb5ce;
  border-bottom: 1px solid #9eb5ce;
  background: #ffffff;
}

.preview-board .preview-corner {
  width: var(--preview-left-width);
  height: var(--preview-top-height);
  background: #dcecf9;
}

.preview-board .preview-top-image,
.preview-board .preview-left-image {
  overflow: hidden;
  background: #f8fbff;
}

.preview-board img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: fill;
}

.preview-board .preview-cell {
  width: var(--preview-cell-size);
  height: var(--preview-cell-size);
}

.preview-board .preview-cell.thick-right {
  border-right-width: 3px;
  border-right-color: #607d9a;
}

.preview-board .preview-cell.thick-bottom {
  border-bottom-width: 3px;
  border-bottom-color: #607d9a;
}

.number-net-preview .preview-cell {
  display: grid;
  place-items: center;
  border-right-color: rgba(224, 48, 48, 0.32);
  border-bottom-color: rgba(224, 48, 48, 0.32);
  color: rgba(0, 76, 220, 0.88);
  font-size: 12px;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.38);
}

.number-net-preview .preview-cell.thick-right {
  border-right-color: rgba(224, 48, 48, 0.72);
}

.number-net-preview .preview-cell.thick-bottom {
  border-bottom-color: rgba(224, 48, 48, 0.72);
}

.camera-box {
  display: grid;
  place-items: center;
  min-height: 260px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.74);
}

.camera-box video,
.camera-box img {
  width: 100%;
  max-height: 420px;
  object-fit: contain;
}

.camera-box p {
  margin: 0;
  color: #52677f;
  font-weight: 700;
  text-align: center;
}

.camera-actions,
.dialog-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.ocr-fields {
  display: grid;
  gap: 12px;
}

.ocr-range-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.66);
}

.ocr-region-editor {
  overflow: auto;
  padding: 8px;
  border: 1px solid rgba(76, 99, 125, 0.24);
  background: rgba(255, 255, 255, 0.7);
}

.ocr-region-editor[hidden] {
  display: none;
}

.ocr-region-stage {
  position: relative;
  width: min(100%, 900px);
  margin: 0 auto;
  touch-action: none;
  user-select: none;
}

.ocr-region-stage img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(76, 99, 125, 0.35);
  background: #ffffff;
}

.ocr-box {
  position: absolute;
  min-width: 34px;
  min-height: 28px;
  border: 3px solid #1e79c7;
  cursor: move;
  background: rgba(30, 121, 199, 0.16);
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.86),
    0 8px 18px rgba(31, 69, 106, 0.18);
}

.ocr-box span {
  position: absolute;
  left: -3px;
  top: -30px;
  min-width: max-content;
  padding: 4px 7px;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  background: #1e79c7;
}

.ocr-box.row-box {
  border-color: #c75b1e;
  background: rgba(199, 91, 30, 0.15);
}

.ocr-box.row-box span {
  background: #c75b1e;
}

.ocr-box i {
  position: absolute;
  right: -9px;
  bottom: -9px;
  width: 18px;
  height: 18px;
  border: 2px solid #ffffff;
  cursor: nwse-resize;
  background: currentColor;
  box-shadow: 0 2px 8px rgba(31, 69, 106, 0.24);
}

.board-corners-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 3;
}

.board-corners-svg polygon {
  fill: rgba(74, 153, 74, 0.12);
  stroke: #2e8b57;
  stroke-width: 3;
  vector-effect: non-scaling-stroke;
}

.board-corner {
  position: absolute;
  z-index: 4;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 3px solid #ffffff;
  border-radius: 50%;
  cursor: grab;
  transform: translate(-50%, -50%);
  background: #2e8b57;
  box-shadow: 0 2px 10px rgba(31, 69, 106, 0.38);
  touch-action: none;
}

.board-corner:active {
  cursor: grabbing;
}

.range-empty {
  margin: 0;
  color: #52677f;
  font-size: 13px;
  font-weight: 700;
}

.range-empty[hidden] {
  display: none;
}

.range-details {
  display: grid;
  gap: 8px;
}

.range-details summary {
  width: fit-content;
  color: #39516c;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.range-grid {
  display: grid;
  grid-template-columns: 80px repeat(4, 1fr);
  gap: 8px;
  align-items: end;
}

.range-grid strong {
  color: #39516c;
  font-size: 13px;
}

.range-grid label {
  display: grid;
  gap: 3px;
  color: #52677f;
  font-size: 12px;
  font-weight: 800;
}

.range-grid input {
  min-width: 0;
  min-height: 34px;
  padding: 5px 6px;
  border: 1px solid rgba(76, 99, 125, 0.58);
  color: #203247;
  font: 700 13px/1.2 "Yu Gothic", "Meiryo", sans-serif;
  background: rgba(255, 255, 255, 0.92);
}

.segmented-results {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
}

.segmented-results[hidden] {
  display: none;
}

.result-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.result-columns h3 {
  margin: 0 0 8px;
  color: #39516c;
  font-size: 15px;
}

.result-list {
  display: grid;
  gap: 5px;
  max-height: 300px;
  overflow: auto;
  padding-right: 4px;
}

.result-row {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 6px;
  align-items: center;
}

.result-row span {
  color: #52677f;
  font-size: 12px;
  font-weight: 900;
}

.result-row input {
  min-width: 0;
  min-height: 32px;
  padding: 5px 7px;
  border: 1px solid rgba(76, 99, 125, 0.42);
  color: #203247;
  font: 700 13px/1.2 "Yu Gothic", "Meiryo", sans-serif;
  background: rgba(255, 255, 255, 0.96);
}

.grid-size-fields .field {
  flex: 1 1 120px;
}

.property-grid {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.property-grid span {
  color: #52677f;
  font-weight: 700;
}

.property-grid strong {
  overflow-wrap: anywhere;
}

.property-image-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid rgba(82, 103, 127, 0.24);
  background: #ffffff;
}

.property-image-wrap[hidden] {
  display: none;
}

.property-image-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.play-layout {
  display: grid;
  grid-template-columns: minmax(240px, 360px) 1fr;
  gap: 18px;
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
}

.source-panel,
.board-panel {
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 16px 36px rgba(91, 130, 171, 0.18);
}

.source-panel {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 12px;
}

.source-image-wrap {
  position: relative;
  display: grid;
  aspect-ratio: var(--mini-cols, 1) / var(--mini-rows, 1);
  background: #ffffff;
}

.source-panel img {
  width: 100%;
  max-height: 52vh;
  object-fit: contain;
  border: 1px solid rgba(83, 112, 142, 0.22);
  background: #ffffff;
}

.source-image-wrap.progress-only-source img {
  display: none;
}

.progress-mini {
  position: absolute;
  left: var(--mini-left, 0);
  top: var(--mini-top, 0);
  display: grid;
  width: var(--mini-width, 100%);
  height: var(--mini-height, 100%);
  max-height: var(--mini-max-height, none);
  aspect-ratio: var(--mini-cols, 1) / var(--mini-rows, 1);
  overflow: hidden;
  border: var(--mini-border, 2px solid rgba(255, 255, 255, 0.95));
  background: var(--mini-background, rgba(255, 255, 255, 0.42));
  box-shadow: var(--mini-shadow, 0 4px 14px rgba(21, 42, 64, 0.3));
  pointer-events: none;
}

.progress-mini i {
  border-right: 1px solid rgba(158, 181, 206, 0.45);
  border-bottom: 1px solid rgba(158, 181, 206, 0.45);
  background: #ffffff;
}

.progress-mini i.painted {
  background: rgba(32, 50, 71, 0.94);
}

.play-meta {
  display: grid;
  gap: 4px;
  color: #52677f;
  font-weight: 700;
}

.board-panel {
  position: relative;
  display: grid;
  align-content: start;
  gap: 14px;
  padding: 14px;
  min-width: 0;
  overflow: hidden;
}

.board-toolbar {
  position: sticky;
  top: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  flex-wrap: wrap;
  padding-bottom: 8px;
  background: rgba(248, 252, 255, 0.94);
  border-bottom: 1px solid var(--line);
}

.board-toolbar span {
  color: #52677f;
  font-size: 13px;
  font-weight: 700;
}

.save-state {
  min-height: 28px;
  padding: 5px 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.62);
}

.save-state[data-save-status="saving"],
.save-state[data-save-status="pending"] {
  color: #2c5f8f;
  border-color: rgba(44, 95, 143, 0.28);
  background: rgba(226, 241, 255, 0.82);
}

.save-state[data-save-status="dirty"],
.save-state[data-save-status="warning"] {
  color: #83620d;
  border-color: rgba(190, 145, 29, 0.34);
  background: rgba(255, 245, 204, 0.9);
}

.save-state[data-save-status="failed"] {
  color: #a31818;
  border-color: rgba(190, 48, 48, 0.44);
  background: rgba(255, 226, 226, 0.96);
  box-shadow: 0 0 0 2px rgba(190, 48, 48, 0.12);
}

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

.tool-group {
  display: inline-flex;
  gap: 6px;
  flex-wrap: wrap;
}

.assist-tools {
  flex-basis: 100%;
}

.input-mode-tools {
  flex-basis: 100%;
}

.tool-button.selected,
.pixel-button.selected {
  color: #ffffff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 44%),
    linear-gradient(180deg, #55728f, #36506e 48%, #203247);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.28),
    0 2px 0 rgba(28, 43, 60, 0.86);
}

.color-tool-button.selected {
  color: var(--swatch-text, #ffffff);
  text-shadow: none;
  background: var(--swatch, #203247);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.24),
    0 0 0 3px #111827;
}

.tool-button:disabled,
.tool-button.mode-disabled {
  opacity: 0.42;
  filter: grayscale(1);
  cursor: not-allowed;
}

.pixel-button.soft-disabled {
  opacity: 0.72;
}

.zoom-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid rgba(76, 99, 125, 0.35);
  color: #39516c;
  font-size: 13px;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.82);
}

.zoom-control input {
  width: 110px;
}

.board-scroll {
  width: 100%;
  max-height: min(68vh, 760px);
  overflow: auto;
  scrollbar-width: auto;
  scrollbar-color: rgba(88, 110, 132, 0.72) rgba(230, 238, 246, 0.82);
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  border: 1px solid rgba(82, 103, 127, 0.28);
  background: #d8e6f2;
  -webkit-overflow-scrolling: touch;
}

.board-scroll::-webkit-scrollbar {
  width: 14px;
  height: 14px;
}

.board-scroll::-webkit-scrollbar-track {
  background: rgba(230, 238, 246, 0.92);
}

.board-scroll::-webkit-scrollbar-thumb {
  border: 2px solid rgba(230, 238, 246, 0.92);
  border-radius: 9px;
  background: rgba(88, 110, 132, 0.74);
}

.board-scrollbar {
  position: absolute;
  z-index: 11;
  pointer-events: none;
  border-radius: 999px;
  background: rgba(230, 238, 246, 0.78);
  box-shadow: 0 0 0 1px rgba(67, 91, 118, 0.26);
}

.board-scrollbar[hidden] {
  display: none;
}

.board-scrollbar i {
  position: absolute;
  display: block;
  border-radius: inherit;
  background: rgba(74, 91, 111, 0.82);
}

.board-scrollbar.horizontal {
  height: 10px;
}

.board-scrollbar.horizontal i {
  top: 0;
  left: 0;
  height: 100%;
}

.board-scrollbar.vertical {
  width: 10px;
}

.board-scrollbar.vertical i {
  top: 0;
  left: 0;
  width: 100%;
}

body:not([data-device-mode="smartphone"]) .board-scrollbar {
  display: none;
}

.play-memo {
  margin-top: 10px;
}

.play-memo textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.55;
}

.manual-save-button[hidden],
.pc-only-control[hidden] {
  display: none;
}

.logic-board {
  position: relative;
  display: grid;
  width: max-content;
  min-width: 100%;
  --cell-size: 30px;
  --top-hint-height: 72px;
  --left-hint-width: 92px;
  background: #9eb5ce;
}

.overlay-dialog {
  width: min(92vw, 720px);
  max-height: min(86vh, 780px);
  padding: 0;
  border: 0;
  color: #243348;
  background: transparent;
}

.overlay-dialog::backdrop {
  background: rgba(40, 57, 78, 0.42);
  backdrop-filter: blur(2px);
}

.overlay-card {
  position: relative;
  overflow: auto;
  max-height: min(86vh, 780px);
  padding: 22px;
  border: 1px solid rgba(78, 103, 130, 0.36);
  background: rgba(248, 252, 255, 0.98);
  box-shadow: 0 18px 42px rgba(20, 38, 58, 0.28);
}

.overlay-close {
  position: absolute;
  top: 10px;
  right: 10px;
}

.message-dialog {
  width: min(88vw, 420px);
}

.message-card {
  min-height: 130px;
  display: grid;
  place-items: center;
  text-align: center;
}

.message-card p {
  margin: 18px 20px 4px;
  font-size: 18px;
  font-weight: 900;
  white-space: pre-line;
}

.toast-message {
  position: fixed;
  top: 18%;
  left: 50%;
  z-index: 90;
  width: min(86vw, 520px);
  padding: 14px 18px;
  color: rgba(20, 38, 58, 0.92);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.55;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-50%) translateY(-8px);
  background: rgba(248, 252, 255, 0.74);
  border: 1px solid rgba(82, 103, 127, 0.24);
  box-shadow: 0 12px 32px rgba(20, 38, 58, 0.18);
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast-message.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.toast-message[hidden] {
  display: none;
}

.calendar-card {
  display: grid;
  gap: 14px;
}

.calendar-head {
  display: grid;
  grid-template-columns: 88px 1fr 88px;
  align-items: center;
  gap: 10px;
  padding-right: 36px;
}

.calendar-head h2,
.settings-card h2 {
  margin: 0;
  text-align: center;
  font-size: 26px;
  letter-spacing: 0;
}

.calendar-summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #39516c;
  font-weight: 900;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid #9eb5ce;
  background: #9eb5ce;
}

.calendar-weekday,
.calendar-day {
  min-height: 74px;
  padding: 8px;
  background: #ffffff;
}

.calendar-weekday {
  min-height: auto;
  text-align: center;
  color: #52677f;
  font-size: 12px;
  font-weight: 900;
  background: #eaf4ff;
}

.calendar-day {
  display: grid;
  align-content: start;
  gap: 6px;
  width: 100%;
  border: 0;
  color: inherit;
  font-size: 12px;
  text-align: left;
  cursor: pointer;
}

.calendar-day.outside {
  color: #9aa9ba;
  background: #f4f7fb;
}

.calendar-day.today {
  box-shadow: inset 0 0 0 2px #4d82b4;
}

.calendar-day.selected {
  box-shadow: inset 0 0 0 3px #203247;
}

.calendar-day.logged-in {
  background: #fff9d8;
}

.calendar-date {
  font-size: 15px;
  font-weight: 900;
}

.calendar-login-mark {
  color: #1c7f56;
  font-weight: 900;
}

.calendar-time {
  color: #52677f;
  font-weight: 800;
}

.calendar-detail {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(76, 99, 125, 0.28);
  background: rgba(255, 255, 255, 0.86);
}

.calendar-detail[hidden] {
  display: none;
}

.calendar-detail h3 {
  margin: 0;
  font-size: 17px;
}

.calendar-session-list {
  display: grid;
  gap: 6px;
}

.calendar-session-row,
.calendar-detail-empty {
  margin: 0;
  color: #243348;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.55;
}

.settings-card {
  display: grid;
  gap: 18px;
}

.settings-section {
  display: grid;
  gap: 10px;
}

.settings-section h3 {
  margin: 0;
  font-size: 17px;
}

.admin-settings-section {
  padding-top: 14px;
  border-top: 1px solid rgba(76, 99, 125, 0.22);
}

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

.settings-note {
  min-height: 1.5em;
  margin: 0;
  color: #39516c;
  font-size: 13px;
  font-weight: 900;
  line-height: 1.5;
}

.notice-card {
  display: grid;
  gap: 14px;
}

.notice-card h2 {
  margin: 0;
  padding-right: 34px;
  text-align: center;
  font-size: 26px;
  letter-spacing: 0;
}

.notice-card textarea {
  min-height: 180px;
  white-space: pre-wrap;
}

.segmented-setting,
.save-scale {
  display: grid;
  gap: 8px;
}

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

.save-scale {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  align-items: stretch;
}

.segmented-setting label,
.save-scale label {
  display: grid;
  min-height: 44px;
  place-items: center;
  padding: 8px;
  border: 1px solid rgba(76, 99, 125, 0.35);
  color: #39516c;
  font-size: 13px;
  font-weight: 900;
  text-align: center;
  cursor: pointer;
  background: #ffffff;
}

.segmented-setting input,
.save-scale input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented-setting label:has(input:checked),
.save-scale label:has(input:checked) {
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 44%),
    linear-gradient(180deg, #55728f, #36506e 48%, #203247);
}

.save-load-note {
  display: flex;
  justify-content: space-between;
  color: #52677f;
  font-size: 12px;
  font-weight: 900;
}

.image-hint-cell {
  overflow: hidden;
  width: auto;
  height: auto;
  padding: 0;
  background: #f8fbff;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.image-hint-cell img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: fill;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

.board-cell {
  position: relative;
  box-sizing: border-box;
  width: var(--cell-size);
  height: var(--cell-size);
  overflow: hidden;
  border: 0;
  border-right: 1px solid #9eb5ce;
  border-bottom: 1px solid #9eb5ce;
  color: #35536f;
  font: 900 calc(var(--cell-size) * 0.58) / 1 sans-serif;
  cursor: pointer;
  background: #ffffff;
}

.board-cell.thick-right {
  border-right-width: 3px;
  border-right-color: #607d9a;
}

.board-cell.thick-bottom {
  border-bottom-width: 3px;
  border-bottom-color: #607d9a;
}

.board-cell[data-mark="paint"] {
  background: #203247;
}

.board-cell[data-mark="color"] {
  background: var(--cell-color, #203247);
}

.board-cell[data-mark="cross"] {
  background: #eff6fc;
}

.board-cell[data-mark="cross"]::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
  width: calc(var(--cell-size) * 1.42);
  height: 2px;
  background: #35536f;
  transform: rotate(45deg);
  transform-origin: 0 0;
  pointer-events: none;
}

.number-net-board-play .board-cell[data-mark="net"] {
  background: #ffffff;
}

.number-net-board-play {
  min-width: max-content;
}

.number-net-board-play .board-cell {
  touch-action: none;
}

.number-net-board-play .board-cell[data-mark="net"]::before {
  display: none;
}

.number-net-board-play.number-net-complete-view .board-cell[data-mark="net"] {
  background: #203247;
}

.number-net-board-play.number-net-complete-view .board-cell[data-mark="net"]::before {
  display: none;
}

.number-net-path-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.number-net-board-play.number-net-complete-view .number-net-path-layer {
  display: none;
}

.number-net-path-segment {
  stroke: #101820;
  stroke-width: 0.14;
  stroke-linecap: round;
}

.number-net-path-dot {
  fill: #101820;
}

.number-net-path-dot.single {
  fill: #101820;
}

.number-net-cell-number {
  position: relative;
  z-index: 3;
  display: inline-grid;
  width: calc(var(--cell-size) * 0.78);
  min-width: 0;
  max-width: calc(var(--cell-size) - 3px);
  height: calc(var(--cell-size) * 0.68);
  min-height: 0;
  padding: 0 1px;
  place-items: center;
  overflow: hidden;
  border-radius: 4px;
  color: #005edc;
  font-size: clamp(8px, calc(var(--cell-size) * 0.42), 18px);
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.82);
}

.number-net-cell-number[data-digits="1"] {
  width: calc(var(--cell-size) * 0.64);
  height: calc(var(--cell-size) * 0.64);
  font-size: clamp(9px, calc(var(--cell-size) * 0.54), 22px);
}

.number-net-cell-number[data-digits="3"] {
  width: calc(var(--cell-size) * 0.9);
  font-size: clamp(7px, calc(var(--cell-size) * 0.32), 15px);
}

.number-net-board-play.number-net-complete-view .number-net-cell-number {
  color: #ffffff;
  background: rgba(0, 94, 220, 0.72);
}

.number-net-helper-panel {
  position: absolute;
  top: 86px;
  left: 14px;
  z-index: 12;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: min(520px, calc(100% - 28px));
  padding: 10px;
  border: 1px solid rgba(76, 99, 125, 0.32);
  background: rgba(248, 252, 255, 0.97);
  box-shadow: 0 10px 24px rgba(32, 50, 71, 0.18);
}

.number-net-helper-panel[hidden] {
  display: none;
}

.number-net-incomplete {
  animation: emptyCellPulse 2s ease-in-out infinite;
  box-shadow: inset 0 0 0 999px rgba(231, 77, 77, 0.22);
}

.board-cell.assist-line-active {
  background-color: #fff3b5;
  box-shadow: inset 0 0 0 999px rgba(255, 226, 82, 0.22);
}

.board-cell[data-mark="paint"].assist-line-active {
  background-color: #203247;
}

.board-cell[data-mark="color"].assist-line-active {
  background-color: var(--cell-color, #203247);
}

.board-cell.has-dot-note::after {
  content: "・";
  position: absolute;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  color: #e22b2b;
  font: 900 calc(var(--cell-size) * 0.66) / 1 sans-serif;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.88);
  pointer-events: none;
}

.board-cell.has-dot-note {
  z-index: 8;
}

.board-cell[data-mark="color"].has-dot-note::after {
  color: #ffffff;
  text-shadow:
    0 1px 2px rgba(0, 0, 0, 0.72),
    0 0 3px rgba(0, 0, 0, 0.66);
}

.logic-board.show-empty-flash .board-cell[data-mark=""] {
  animation: emptyCellPulse 2s ease-in-out infinite;
}

.run-count-label {
  z-index: 3;
  align-self: center;
  justify-self: center;
  display: grid;
  min-width: calc(var(--cell-size) * 0.74);
  min-height: calc(var(--cell-size) * 0.74);
  padding: 0 4px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  font: 900 calc(var(--cell-size) * 0.48) / 1 sans-serif;
  background: rgba(32, 50, 71, 0.84);
  box-shadow: 0 2px 8px rgba(17, 38, 60, 0.18);
  pointer-events: none;
}

.run-count-label.horizontal {
}

@keyframes emptyCellPulse {
  0%,
  100% {
    background: #ffffff;
  }

  50% {
    background: rgba(231, 77, 77, 0.28);
  }
}

.hint-cell {
  display: flex;
  border-right: 1px solid #9eb5ce;
  border-bottom: 1px solid #9eb5ce;
  color: #243348;
  font-weight: 900;
  background: #f4f9ff;
}

.corner-cell {
  position: sticky;
  top: 0;
  left: 0;
  z-index: 6;
  width: var(--left-hint-width);
  height: var(--top-hint-height);
  background: #dcecf9;
}

.top-hint-cell {
  position: sticky;
  top: 0;
  z-index: 5;
  align-items: flex-end;
  justify-content: flex-end;
  width: var(--cell-size);
  height: var(--top-hint-height);
  padding: 4px 2px;
  flex-direction: column;
  font-size: 12px;
  line-height: 1.05;
  overflow: hidden;
}

.left-hint-cell {
  position: sticky;
  left: 0;
  z-index: 4;
  align-items: center;
  justify-content: flex-end;
  width: var(--left-hint-width);
  height: var(--cell-size);
  gap: 4px;
  padding: 2px 7px;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  background: #f4f9ff;
}

.top-hint-cell span,
.left-hint-cell span {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: clip;
}

.logic-board .top-hint-cell.image-hint-cell {
  width: auto;
  height: var(--top-hint-height);
  align-items: stretch;
  justify-content: stretch;
  flex-direction: row;
  padding: 0;
}

.logic-board.hint-follow-size .top-hint-cell.image-hint-cell {
  overflow-x: hidden;
  overflow-y: auto;
  touch-action: pan-y;
}

.logic-board.hint-follow-size .top-hint-cell.image-hint-cell img {
  flex: 0 0 auto;
  max-width: none;
  width: 100%;
  min-height: 100%;
  height: auto;
}

.logic-board .left-hint-cell.image-hint-cell {
  width: var(--left-hint-width);
  height: auto;
  align-items: stretch;
  justify-content: stretch;
  gap: 0;
  padding: 0;
  white-space: normal;
}

.logic-board.hint-follow-size .left-hint-cell.image-hint-cell {
  overflow-x: auto;
  overflow-y: hidden;
  touch-action: pan-x;
}

.logic-board.hint-follow-size .left-hint-cell.image-hint-cell img {
  flex: 0 0 auto;
  max-width: none;
  width: auto;
  min-width: 100%;
  height: 100%;
}

.file-button {
  display: inline-grid;
  place-items: center;
}

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

@media (max-width: 560px) {
  .screen {
    grid-template-rows: minmax(96px, 22vh) auto 1fr;
    padding-top: 22px;
  }

  .menu {
    gap: 9px;
    margin-top: 34px;
  }

  .menu button {
    min-height: 46px;
    font-size: 16px;
  }

  .library-view {
    grid-template-rows: auto 1fr;
  }

  .page-header {
    grid-template-columns: 76px 1fr 76px;
    width: calc(100vw - 20px);
    gap: 8px;
  }

  .page-header h1 {
    font-size: 36px;
    -webkit-text-stroke-width: 2px;
  }

  .pixel-button.small {
    min-height: 36px;
    padding-inline: 6px;
    font-size: 13px;
  }

  .library-panel {
    width: calc(100vw - 20px);
    padding: 12px;
  }

  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-title h2 {
    font-size: 19px;
  }

  .type-choices {
    grid-template-columns: 1fr;
  }

  .issue-fields,
  .hint-image-grid {
    grid-template-columns: 1fr;
  }

  .type-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }

  .camera-actions,
  .dialog-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .admin-time-grid {
    grid-template-columns: 1fr;
  }

  .camera-box {
    min-height: 210px;
  }

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

  .range-grid strong {
    grid-column: 1 / -1;
  }

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

  .play-layout {
    grid-template-columns: 1fr;
    width: calc(100vw - 20px);
  }

  .logic-board {
    min-width: max-content;
  }

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

  .board-scroll {
    max-height: 62vh;
  }

  .board-toolbar {
    gap: 8px;
  }

  .calendar-head {
    grid-template-columns: 72px 1fr 72px;
  }

  .calendar-day {
    min-height: 58px;
    padding: 5px;
  }

  .save-scale {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .zoom-control {
    width: 100%;
    justify-content: space-between;
  }

  .zoom-control input {
    flex: 1;
    width: auto;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .play-view {
    padding-top: 12px;
  }

  .play-layout {
    grid-template-columns: minmax(180px, 28vw) 1fr;
    gap: 10px;
  }

  .source-panel img {
    max-height: 38vh;
  }

  .board-scroll {
    max-height: 58vh;
  }

  .board-toolbar {
    position: sticky;
    top: 0;
  }
}
