:root {
  --line: 1.5px;
  --ink: #000;
  --bg: #fff;
  --desktop: #dcdcdc;
  --font-ui: "DotGothic16", ui-monospace, Menlo, Monaco, "Courier New", monospace;
}

body {
  margin: 0;
  background-color: var(--desktop);
  background-image:
    repeating-linear-gradient(45deg,
      rgba(0, 0, 0, 0.08) 0,
      rgba(0, 0, 0, 0.08) 1px,
      transparent 1px,
      transparent 2px);
}

.hc-window {
  width: min(980px, 92vw);
  height: min(640px, 90vh);
  margin: 24px auto;
  background: var(--bg);
  border: var(--line) solid var(--ink);
  box-shadow: var(--line) var(--line) 0 var(--ink);
  display: flex;
  flex-direction: column;
}

/* ===== Titlebar ===== */
.hc-titlebar {
  height: 26px;
  display: grid;
  grid-template-columns: 1fr auto 1fr auto 10px;
  align-items: center;
  gap: 4px;
  padding: 0 2px;
  border-bottom: var(--line) solid var(--ink);
  letter-spacing: 0.12em;
  text-shadow: 1px 0 0 currentColor;
}

.hc-stripes {
  height: 16px;
  background:
    repeating-linear-gradient(to bottom,
      var(--ink) 0,
      var(--ink) var(--line),
      transparent var(--line),
      transparent calc(var(--line) * 2));
}

.hc-stripes.tail {
  width: 10px;
  justify-self: end;
}

.hc-title {
  font-family: var(--font-ui);
  font-size: 17px;
  font-weight: 600;
  white-space: nowrap;
  padding: 0 5px;
  transform: translateY(-1px);
}

.hc-sysbox {
  width: 14px;
  height: 14px;
  border: var(--line) solid var(--ink);
  position: relative;
}

.hc-sysbox::after {
  content: "";
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 8px;
  height: 8px;
  border-right: var(--line) solid var(--ink);
  border-bottom: var(--line) solid var(--ink);
}

/* ===== Content ===== */
.hc-content {
  flex: 1;
  min-height: 0;
}

.hc-body {
  display: flex;
  height: 100%;
  padding-top: 10px;
  box-sizing: border-box;
}

.hc-image {
  flex: 0 0 300px;
  border-right: var(--line) solid var(--ink);
  padding: 8px;
  box-sizing: border-box;
}

.hc-image img {
  width: 100%;
  height: auto;
  display: block;
  image-rendering: pixelated;
}

.hc-image .hc-image-empty {
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.5;
  border: var(--line) dashed var(--ink);
  padding: 8px;
  background: #fff;
}

.hc-text {
  flex: 1;
  padding: 10px 12px;
  overflow-y: auto;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  min-width: 0;
}

.hc-text h1 {
  margin: 0 0 10px;
  font-size: 18px;
}

.hc-text p {
  margin: 0 0 12px;
}

.hc-meta {
  font-size: 12px;
  margin: 0 0 10px;
  opacity: 0.85;
}

.hc-hidden {
  display: none !important;
}

/* ===== Bottom Toolbar ===== */
.hc-toolbar {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 4px;
  box-sizing: border-box;

  background-color: #d9d9d9;
  background-image:
    repeating-linear-gradient(0deg,
      rgba(0, 0, 0, 0.14) 0px,
      rgba(0, 0, 0, 0.14) 1px,
      transparent 1px,
      transparent 2px),
    repeating-linear-gradient(90deg,
      rgba(0, 0, 0, 0.10) 0px,
      rgba(0, 0, 0, 0.10) 1px,
      transparent 1px,
      transparent 2px);
  background-size: 3px 3px;
  image-rendering: pixelated;
}

.hc-actions {
  display: flex;
  gap: 4px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.hc-btn {
  --btn-line: 1px;
  position: relative;
  box-sizing: border-box;
  border: var(--btn-line) solid var(--ink);
  box-shadow:
    inset 0 0 0 1px #fff,
    1px 1px 0 var(--ink);
  background-color: #fff;
  background-image:
    repeating-linear-gradient(45deg,
      rgba(0, 0, 0, 0.08) 0,
      rgba(0, 0, 0, 0.08) 1px,
      transparent 1px,
      transparent 2px);
  image-rendering: pixelated;
  font-family: var(--font-ui);
  cursor: pointer;
  user-select: none;
}

.hc-btn:active {
  box-shadow: inset 0 0 0 1px #fff;
  transform: translate(1px, 1px);
}

.hc-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.hc-nav {
  width: 32px;
  height: 40px;
  padding: 0;
  border: none;
  box-shadow: none;
  background: none;
}

.hc-nav:focus,
.hc-nav:focus-visible {
  outline: none;
  box-shadow: none;
}

.hc-action {
  flex: 1;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  text-align: center;
  white-space: nowrap;
  font-size: 13px;
  line-height: 24px;
  transform: translateY(-0.5px);
}

.hc-action.is-active {
  background: var(--ink);
  color: #fff;
  background-image: none;
}

.hc-nav.prev::before,
.hc-nav.prev::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 7px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
}

.hc-nav.prev::before {
  border-top: 21px solid transparent;
  border-bottom: 21px solid transparent;
  border-right: 18px solid var(--ink);
}

.hc-nav.prev::after {
  left: 8px;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-right: 15px solid #fff;
}

.hc-nav.next::before,
.hc-nav.next::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 7px;
  transform: translateY(-50%);
  width: 0;
  height: 0;
}

.hc-nav.next::before {
  border-top: 21px solid transparent;
  border-bottom: 21px solid transparent;
  border-left: 18px solid var(--ink);
}

.hc-nav.next::after {
  right: 8px;
  border-top: 18px solid transparent;
  border-bottom: 18px solid transparent;
  border-left: 15px solid #fff;
}

/* ===== Editor ===== */
.hc-editor {
  border-top: var(--line) solid var(--ink);
  padding-top: 10px;
  margin-top: 12px;
}

.hc-field {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 8px;
  align-items: center;
  margin: 0 0 8px;
}

.hc-field label {
  font-size: 12px;
}

.hc-input,
.hc-textarea {
  font-family: var(--font-ui);
  font-size: 13px;
  border: var(--line) solid var(--ink);
  box-shadow: inset 0 0 0 1px #fff;
  padding: 6px 8px;
  background: #fff;
  width: 100%;
  box-sizing: border-box;
}

.hc-textarea {
  min-height: 220px;
  resize: vertical;
  line-height: 1.6;
}

.hc-help {
  font-size: 12px;
  opacity: 0.9;
  margin: 6px 0 0;
}

/* ===== Modal ===== */
.hc-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  display: grid;
  place-items: center;
  padding: 16px;
}

.hc-modal {
  width: min(720px, 92vw);
  max-height: min(520px, 80vh);
  background: var(--bg);
  border: var(--line) solid var(--ink);
  box-shadow: var(--line) var(--line) 0 var(--ink);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--font-ui);
}

.hc-modal-header {
  height: 26px;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  padding: 0 8px;
  border-bottom: var(--line) solid var(--ink);
  background: #fff;
}

.hc-modal-title {
  font-size: 14px;
  letter-spacing: 0.08em;
}

.hc-modal-close {
  width: 18px;
  height: 18px;
  padding: 0;
  line-height: 18px;
  text-align: center;
    /* 既存の X 文字を消す */
  font-size: 0;
  color: transparent;

  /* 描画基準 */
  position: relative;
}

/* ❌ を描く */
.hc-modal-close::before,
.hc-modal-close::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 12px;
  height: 2px; /* 線の太さ */
  background: var(--ink);
  transform-origin: center;
}

.hc-modal-close::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.hc-modal-close::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.hc-modal-body {
  padding: 10px;
  overflow: auto;
  min-height: 0;
}

.hc-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}

.hc-list button {
  width: 100%;
  text-align: left;
  padding: 8px 10px;
  font-family: var(--font-ui);
  border: var(--line) solid var(--ink);
  box-shadow: inset 0 0 0 1px #fff, 1px 1px 0 var(--ink);
  background: #fff;
  cursor: pointer;
}

.hc-list button:hover {
  background: #f2f2f2;
}

.hc-searchbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 0 0 10px;
}

.hc-pill {
  font-size: 12px;
  border: var(--line) solid var(--ink);
  padding: 3px 6px;
  background: #fff;
  display: inline-block;
}

#imageEditPane {
  height: 100%;
  box-sizing: border-box;
}

#imageComponentHost {
  height: 100%;
  border: var(--line) dashed var(--ink);
  padding: 8px;
  font-family: var(--font-ui);
  font-size: 12px;
}

#imageComponentHost input,
#imageComponentHost button {
  font-family: var(--font-ui);
  font-size: 12px;
}

/* ===== Window Maximize ===== */
.hc-sysbox {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  padding: 0;
  margin: 0;
  cursor: pointer;
  font: inherit;
}

.hc-sysbox:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.hc-window.is-maximized {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  box-shadow: none;
}

body.is-window-maximized {
  overflow: hidden;
}
