/* The writer page (write/index.html), on top of the look every page shares (/style.css): the controls, the card's
   contents, the progress bar and the dialog. A button or a field always has a visible edge (at least 3:1 against
   the white around it); the text is the ink colour on white or on a very light tint. */

/* --- the very important: this browser cannot be used, and writing now --- */
#unsupported {
  display: flex; gap: 12px; align-items: flex-start;
  margin: 8px; padding: 12px;
  background: #ffff99; color: #000;
  border: 6px solid #d00000; box-shadow: 0 0 0 2px #000;
}
#unsupported .mark { flex: none; }
#unsupported .title { margin: 0 0 6px; font-size: 1.4rem; font-weight: bold; line-height: 1.3; color: #d00000; }
#unsupported-text { font-size: 1.05rem; font-weight: bold; }
#unsupported .more { font-size: .9rem; }
#unsupported a { color: #0000ee; }
#busy-band {
  position: sticky; top: 0; z-index: 10;
  padding: 8px 12px; text-align: center;
  background: #ffff00; color: #000; font-size: 1rem;
  border-style: solid; border-width: 8px 0;
  border-image: repeating-linear-gradient(45deg, #000 0 8px, #ffd400 8px 16px) 8;   /* 工事中 stripes */
}

/* --- boxes --- */
.note { margin: 2px 0 10px; }
.label { display: block; color: var(--muted); font-size: .8rem; }
.status { margin: 0 0 8px; padding: 6px 12px; background: var(--tint); box-shadow: inset 0 0 0 2px var(--edge); }
#status { display: block; font-weight: bold; }

/* --- buttons: white with a pixel edge; the one to press is pink --- */
button, input[type=file]::file-selector-button {
  font: inherit; color: var(--ink); background: #fff; border: 0; border-radius: 0;
  box-shadow: 0 -2px 0 #8a76b8, 0 2px 0 #8a76b8, -2px 0 0 #8a76b8, 2px 0 0 #8a76b8;
}
button {
  display: block; width: calc(100% - 4px); min-height: 48px; margin: 10px 2px 4px; padding: 8px 14px;
  font-size: 1rem; font-weight: bold; cursor: pointer;
}
button:not(:disabled):hover { background: var(--tint); }
button.primary {
  color: #fff; background: var(--accent); margin-bottom: 10px;
  box-shadow: 0 -3px 0 var(--pink), 0 3px 0 var(--pink), -3px 0 0 var(--pink), 3px 0 0 var(--pink), 0 9px 0 var(--accent-dark);
}
button.primary:not(:disabled):hover { background: #d1408f; }
button.primary:disabled { color: #f3dcea; background: #a8708f; box-shadow: 0 -3px 0 #d9b4c9, 0 3px 0 #d9b4c9, -3px 0 0 #d9b4c9, 3px 0 0 #d9b4c9; }
button:not(:disabled):active { transform: translateY(2px); }
button:disabled { color: #7a6e92; background: #f1ecf7; box-shadow: 0 -2px 0 #cfc6e0, 0 2px 0 #cfc6e0, -2px 0 0 #cfc6e0, 2px 0 0 #cfc6e0; cursor: default; }
@media (min-width: 640px) {
  .panel > button, .panel > .pick > button, .extras > button { display: inline-block; width: auto; min-width: 300px; }
  #pers-row > button { display: inline-block; width: auto; min-width: 160px; }
}

/* --- what to write: the site's latest build (in front; a file of one's own is folded under 「その他の操作」) --- */
.pick { margin: 10px 0 4px; border-top: 2px dotted var(--edge); padding-top: 8px; }
/* the card (PROF) and the personality: optional, folded; 「名刺と性格（任意）」 is in 「3. 書き込む」 before the write button and opens
   by itself when the card can still choose a personality (#pers-row) */
.extras { margin: 10px 0 4px; border-top: 2px dotted var(--edge); padding-top: 4px; }
.extras summary { display: flex; align-items: center; min-height: 44px; font-weight: bold; color: var(--link); cursor: pointer; }
.extras > summary::before { content: "▶"; margin-right: .5em; font-size: .8em; }
.extras[open] > summary::before { content: "▼"; }
/* everything but connecting and writing, folded under one heading 「その他の操作」; the items inside are folds of their own */
.others > summary { display: flex; align-items: center; min-height: 44px; margin-bottom: 0; font-size: 1.1rem; font-weight: bold; cursor: pointer; }
.others > summary::before { content: "▶"; color: var(--pink); margin-right: .5em; font-size: .8em; }
.others[open] > summary::before { content: "▼"; }
.others[open] > summary { margin-bottom: 10px; }

/* --- the card --- */
.counts { width: 100%; border-collapse: separate; border-spacing: 6px 2px; margin: 0 0 4px; table-layout: fixed; }
.counts th { font-size: .8rem; font-weight: normal; color: var(--muted); }
.counts td {
  background: var(--tint); text-align: center; padding: 2px 0; box-shadow: 0 0 0 2px var(--edge);
  font-size: 1.1rem; font-weight: bold; font-variant-numeric: tabular-nums;
}
/* the verdict of the card, above the numbers: whether the write fits, whether the card's 犬DOGE is the latest (the numbers under it are small) */
.verdict { margin: 10px 0 4px; font-size: 1.25rem; font-weight: bold; line-height: 1.5; }
.verdict.bad { color: #b00020; }
.counts td.lack { background: #ffe0e0; color: #b00020; }
#space-note, #version { white-space: pre-line; }
#manual a { display: inline-block; padding: 12px 0; }      /* the manual's link, a tap target of 44px or more */

.files { list-style: none; padding: 0; margin: 8px 0 0; background: #fff; box-shadow: 0 0 0 2px var(--edge); }
.files:empty { display: none; }
.files li { border-bottom: 1px dotted #b9a8dc; }
.files li:last-child { border-bottom: 0; }
.files label { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 6px 10px; }
.files input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }
.files .text { flex: 1; min-width: 0; }
.files .main { display: block; overflow-wrap: anywhere; }
.files .sub { display: block; color: var(--muted); font-size: .75rem; overflow-wrap: anywhere; }
.files .blocks { flex: none; font-size: .85rem; text-align: right; }
.files li.app .main { color: var(--link); font-weight: bold; }
.files li.app .main::before { content: "★"; color: #b86a00; margin-right: .2em; }
.files li.broken .main { color: #6b6080; }
.files li.broken .blocks { color: #b00020; }
.files li:has(input:checked) { background: var(--accent); color: #fff; }
.files li:has(input:checked) .sub, .files li:has(input:checked) .main { color: #fff; }

/* --- writing --- */
.field { display: block; font-weight: bold; margin: 12px 0 4px; }
input[type=file] { display: block; width: 100%; padding: 2px 0; font: inherit; font-size: .9rem; }   /* Chrome clips a file input at its padding box: the button's 2px edge above and below needs the room */
input[type=file]::file-selector-button { min-height: 44px; padding: 8px 14px; margin: 0 12px 0 2px; font-weight: bold; cursor: pointer; }
input[type=file]:disabled::file-selector-button { color: #7a6e92; background: #f1ecf7; box-shadow: 0 -2px 0 #cfc6e0, 0 2px 0 #cfc6e0, -2px 0 0 #cfc6e0, 2px 0 0 #cfc6e0; }
.at-input { display: flex; align-items: center; background: #fff; box-shadow: inset 0 0 0 2px #8a76b8; }
.at-input span { padding: 0 2px 0 10px; }
/* input[type=text] (below) has the same weight as .at-input input and comes later: it painted the input white over the box's edge,
   so the selector says input[type=text] too */
.at-input input[type=text] {
  flex: 1; min-width: 0; min-height: 44px; margin: 0; border: 0; box-shadow: none; background: transparent; color: var(--ink);
  font: inherit; font-size: 1rem; padding: 8px 10px 8px 0; outline: none;
}
.at-input input[type=text]:focus-visible { outline: none; }          /* the box's ring (below) is the only one */
.at-input:focus-within { outline: 3px solid var(--pink); outline-offset: 2px; }
.at-input:has(input:disabled) { background: #f1ecf7; }
select, input[type=text] {
  display: block; width: 100%; min-height: 44px; background: #fff; color: var(--ink); border: 0; border-radius: 0;
  box-shadow: inset 0 0 0 2px #8a76b8; font: inherit; font-size: 1rem; padding: 8px 10px; margin: 0 0 10px;
}
select:focus-visible, input[type=text]:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
select:disabled, input[type=text]:disabled { background: #f1ecf7; color: #7a6e92; }
#owner-id-row .at-input { margin: 0 0 10px; }
.pers-pick { display: flex; align-items: center; gap: 8px; }        /* 前の語 で 後ろの語 */
.pers-pick select { flex: 1; min-width: 0; margin: 0; }

#log {
  margin: 0; padding: 6px 8px; min-height: 3em; max-height: 45vh; overflow: auto; background: var(--tint); box-shadow: inset 0 0 0 2px var(--edge);
  font-family: "MS Gothic", "ＭＳ ゴシック", Osaka-mono, monospace;
  font-size: .78rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}

/* --- progress (the block bar) --- */
#progress {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: #fff; box-shadow: 0 -3px 0 var(--pink); font-size: .9rem; font-weight: bold; font-variant-numeric: tabular-nums;
}
#bar { flex: 1; height: 24px; appearance: none; -webkit-appearance: none; background: var(--tint); padding: 2px; box-shadow: inset 0 0 0 2px #8a76b8; }
#bar::-webkit-progress-bar { background: var(--tint); }
#bar::-webkit-progress-value { background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 12px); }
#bar::-moz-progress-bar { background: repeating-linear-gradient(90deg, var(--accent) 0 10px, transparent 10px 12px); }

/* --- the dialog (a panel with a pink title) --- */
dialog {
  width: min(420px, calc(100vw - 24px)); padding: 0; border: 0; background: #fff; color: var(--ink);
  box-shadow: 0 -3px 0 var(--pink), 0 3px 0 var(--pink), -3px 0 0 var(--pink), 3px 0 0 var(--pink);
}
dialog::backdrop { background: rgb(40 24 64 / .5); }
dialog h2 { margin: 0; padding: 6px 14px; font-size: 1rem; color: #fff; background: var(--accent); }
.dialog-body { padding: 12px; }
#dialog-text { white-space: pre-line; overflow-wrap: anywhere; margin: 0 0 12px; }
dialog .buttons { display: flex; gap: 12px; padding: 0 2px; }
dialog .buttons button { margin: 4px 0; flex: 1; width: auto; }
dialog .buttons.three { flex-direction: column-reverse; }          /* 消す / 残す / やめる, from the top */
/* the confirmation's table: the item on the left, its value on the right (the value wraps; a line of its own spans both) */
#dialog-rows { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0 0 12px; }
#dialog-rows > div { display: contents; }
#dialog-rows dt { font-weight: bold; }
#dialog-rows dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
#dialog-rows > div.wide { display: block; grid-column: 1 / -1; white-space: pre-line; overflow-wrap: anywhere; }
#dialog-note { margin: 10px 0 0; font-size: .85rem; }
#dialog-links { margin: 0 0 12px; padding-left: 1.3em; }
#dialog-links a { display: inline-block; padding: 10px 0; }
