@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
}

@font-face {
  font-family: "IBM Plex Mono";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/ibm-plex-mono-500.woff2") format("woff2");
}

@font-face {
  font-family: "Sheet JP";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/noto-jp-sheet.ttf") format("truetype");
}

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07090c;
  --fg: #e6e2d8;
  --mute: #7a8080;
  --ink: #6a9ea4;
  --line: color-mix(in oklab, var(--fg) 18%, transparent);
  --fill: #0a0d11;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #d9d4c8;
  --fg: #16191c;
  --mute: #5c6162;
  --ink: #3d6d72;
  --line: color-mix(in oklab, var(--fg) 20%, transparent);
  --fill: #e6e1d6;
}

:root {
  --font: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --jp: "Sheet JP", "Noto Sans JP", "Hiragino Sans", sans-serif;
  --gutter: clamp(8px, 1.6vw, 16px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}

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

body {
  font-family: var(--font);
  font-size: 13px;
  background: var(--bg);
  color: var(--fg);
}

::selection {
  background: var(--ink);
  color: var(--bg);
}

:focus { outline: none; }
:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.skip {
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 20;
  background: var(--fg);
  color: var(--bg);
  padding: 6px 8px;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip:focus { transform: none; }

.sheet {
  position: relative;
  height: 100dvh;
  height: 100svh;
  display: grid;
  grid-template-rows: auto 1fr;
  margin: var(--gutter);
  padding: 8px;
  border: 1px solid var(--line);
  background: var(--fill);
  min-height: 0;
}

.board {
  position: relative;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
}

.tty {
  display: block;
  width: 100%;
  height: 100%;
  cursor: text;
  touch-action: manipulation;
}

.ghost {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  resize: none;
  font-size: 16px;
  caret-color: transparent;
  background: transparent;
  color: transparent;
  pointer-events: none;
}

@media (max-width: 720px) {
  :root { --gutter: 0px; }
  .sheet {
    margin: 0;
    padding: 0;
    border: 0;
    height: 100dvh;
    height: 100svh;
    grid-template-rows: 0 1fr;
  }
  .rule,
  .head { display: none; }
  html, body {
    height: 100%;
    overflow: hidden;
  }
}

.rule {
  position: absolute;
  background: var(--ink);
  pointer-events: none;
}
.rule-t, .rule-b { height: 2px; left: 5px; right: 5px; }
.rule-l, .rule-r { width: 2px; top: 5px; bottom: 5px; }
.rule-t { top: 5px; }
.rule-b { bottom: 5px; }
.rule-l { left: 5px; }
.rule-r { right: 5px; }

.head {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--mute);
}

button:not(:disabled) { cursor: pointer; }

.seo {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#app {
  min-height: 100dvh;
  min-height: 100svh;
}

