/* Talking to a neighbor (M1a), restyled in run 4. The panel is the counter at Osoberto's: a tile
   border along its edge, the local's name on a HELLO sticker, a favor on an order ticket, the
   lines you might say on strips of tape. Since November 14, 2026 those lines are how Ben talks
   (two to four of them, picked: .talk-choices); the text box and its three suggested lines
   (.talk-form, .talk-sug) are only there with ?typed=1. Text inputs are 16px or larger so iOS
   does not zoom the page on focus. (The flip phone's own styles are in phone.css.) */

/* --- the conversation panel ------------------------------------------------ */
.talk {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--kb, 0px); /* lifted above the phone keyboard by talkpanel.js */
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 0 calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l));
  pointer-events: none;
  font-family: var(--body);
}
.talk[hidden] { display: none; }
.talk.kb { padding-bottom: 6px; }
.talk-card {
  position: relative;
  pointer-events: auto;
  touch-action: manipulation;
  width: min(660px, 100%);
  /* (never tall enough to cover the two bears: the camera drops its aim during a conversation so
     they stand in the upper half of the screen, and the log scrolls) */
  max-height: min(58vh, 430px);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  background-image: linear-gradient(175deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0) 34%);
  color: var(--brown-deep);
  border: 4px solid var(--brown-deep);
  border-radius: 6px;
  box-shadow: 0 6px 0 var(--brown-deep), 0 10px 0 rgba(36, 21, 12, 0.35);
}
/* the tile along the edge of the counter */
.talk-card::before {
  content: ""; flex: none; height: 12px;
  background: var(--tile) 0 0 / 36px 36px repeat-x;
  border-bottom: 3px solid var(--brown-deep);
}
.talk-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 12px;
  min-height: 46px;
  background: var(--paper-2);
  border-bottom: 2px dashed rgba(90, 58, 34, 0.45);
}
/* HELLO my name is: a red sticker, stuck on a little crooked, the name in marker on its white field */
.talk-hello {
  flex: none; position: relative; z-index: 1;
  display: grid; grid-template-columns: auto auto; align-items: baseline; column-gap: 6px;
  margin: -22px 0 -10px -4px; padding: 3px 5px 5px;
  background: var(--red); color: var(--white);
  border-radius: 9px;
  box-shadow: 0 0 0 3px var(--white), 0 0 0 5px var(--brown-deep), 0 5px 0 5px rgba(36, 21, 12, 0.35);
  transform: rotate(-2.6deg);
  max-width: 62%;
}
.talk-hello b { font: 900 15px/1 var(--body); letter-spacing: 0.1em; padding-left: 4px; }
.talk-hello i { font: 700 9.5px/1 var(--body); font-style: normal; letter-spacing: 0.04em; text-transform: lowercase; opacity: 0.95; }
.talk-name {
  grid-column: 1 / -1; margin-top: 3px; padding: 2px 10px 3px; min-width: 96px;
  background: var(--white); border-radius: 0 0 5px 5px;
  --sign: 27px; line-height: 0; justify-content: flex-start;
  overflow: hidden;
}
/* how well they know you: stamped, in the office's red ink */
.talk-stage {
  flex: none;
  font: 900 11px/1 var(--body); letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--red-deep); padding: 4px 8px 3px;
  border: 2.5px solid var(--red-deep); border-radius: 4px;
  transform: rotate(-4deg); opacity: 0.88;
}
.talk-stage:empty { display: none; }
.talk-stage.up { animation: talk-pop 0.9s ease; }
@keyframes talk-pop { 0% { transform: rotate(-4deg) scale(1); } 30% { transform: rotate(-10deg) scale(1.5); color: var(--green); border-color: var(--green); } 100% { transform: rotate(-4deg) scale(1); } }
/* and how far to the next stage: a row of punches on a loyalty card */
.talk-meter {
  flex: 1 1 40px; min-width: 30px; height: 14px; box-sizing: border-box; overflow: hidden;
  background: var(--white); border: 2px solid var(--brown-deep); border-radius: 3px;
  background-image: repeating-linear-gradient(90deg, rgba(36, 21, 12, 0) 0 calc(10% - 1.5px), rgba(36, 21, 12, 0.5) calc(10% - 1.5px) 10%);
}
.talk-meter i { display: block; height: 100%; width: 0; background: var(--gold); transition: width 0.6s ease; mix-blend-mode: multiply; }
.talk-close { flex: none; min-height: 36px; padding: 0 14px; font-size: 12px; }
.talk-log {
  flex: 1 1 auto;
  min-height: 44px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 16px 14px 4px;
  font-size: 15.5px;
  line-height: 1.38;
  -webkit-user-select: text;
  user-select: text;
}
.talk-log p { margin: 0 0 8px; overflow-wrap: anywhere; }
.talk-log .them { font-weight: 700; }
.talk-log .them::before { content: attr(data-who) " "; color: var(--red); font-weight: 900; text-transform: uppercase; font-size: 0.82em; letter-spacing: 0.06em; margin-right: 2px; }
.talk-log .me { color: var(--green-deep); font-weight: 700; text-align: right; }
.talk-log .me::before { content: "You  "; color: var(--green); font-weight: 900; text-transform: uppercase; font-size: 0.82em; letter-spacing: 0.06em; }
.talk-log .note { font-size: 12px; font-weight: 700; color: #7a6248; text-align: center; letter-spacing: 0.02em; }
.talk-log .note.good { color: var(--green); }
.talk-log .note.bad { color: var(--red); }
.talk-log .them.live::after { content: "▍"; color: var(--red); animation: talk-blink 0.7s steps(2) infinite; margin-left: 1px; }
@keyframes talk-blink { 50% { opacity: 0; } }
/* the help card: plain on purpose */
.talk-notice {
  margin: 0 10px 8px; padding: 9px 12px; border-radius: 6px;
  background: #eef6ee; border: 3px solid var(--green); font-size: 14px; line-height: 1.35;
}
.talk-notice[hidden] { display: none; }
.talk-notice b { display: block; font-size: 15px; margin-bottom: 2px; }

/* a favor on the table: an order ticket off the pad. What it is, what it pays, and the two answers. */
.talk-offer {
  flex: none; position: relative;
  display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap;
  margin: 2px 12px 9px 14px; padding: 8px 9px 8px 30px;
  background: #f3f8e8;
  background-image: repeating-linear-gradient(0deg, rgba(47, 125, 79, 0) 0 21px, rgba(47, 125, 79, 0.22) 21px 22px);
  border: 2px solid var(--green-deep); border-top: 2px dashed var(--green-deep); border-radius: 2px;
  box-shadow: 0 3px 0 rgba(36, 21, 12, 0.3);
  transform: rotate(-0.5deg);
}
/* the holes it hung on the spike by */
.talk-offer::before {
  content: ""; position: absolute; left: 9px; top: 0; bottom: 0; width: 10px;
  background: radial-gradient(circle at 5px 5px, var(--brown-deep) 0 3px, transparent 3.6px) 0 8px / 10px 22px repeat-y;
}
.talk-offer[hidden] { display: none; }
.talk-offer-what { flex: 1 1 200px; min-width: 0; display: flex; align-items: baseline; gap: 3px 9px; flex-wrap: wrap; }
.talk-offer-what i { font: 900 10.5px/1 var(--mono); font-style: normal; letter-spacing: 0.1em; text-transform: uppercase; color: var(--red); }
.talk-offer-what i::before { content: "Order up · "; }
.talk-offer-what b { font: 900 16.5px/1.15 var(--body); }
.talk-offer-what i { flex-basis: 100%; }
.talk-offer-pay { display: inline-flex; align-items: center; gap: 5px; font: 900 15px/1 var(--mono); font-variant-numeric: tabular-nums; }
.talk-offer-pay::before { content: "PAYS"; font-size: 11px; letter-spacing: 0.1em; color: var(--green-deep); }
.talk-offer-pay .coin { width: 20px; height: 20px; background: var(--sand-dollar) center / contain no-repeat; }
/* what they are asking, in their own words, in the hand the order was taken down in */
.talk-offer-ask { flex: 1 1 100%; margin: 0; font: italic 700 13.5px/1.36 Georgia, "Times New Roman", serif; color: #3a2a1c; overflow-wrap: anywhere; }
.talk-offer-ask::before { content: "\201C"; }
.talk-offer-ask::after { content: "\201D"; }
.talk-offer-ask[hidden] { display: none; }
.talk-offer-answers { flex: none; display: flex; gap: 8px; margin-left: auto; }
.talk-yes, .talk-no { min-height: 44px; padding: 0 14px; font-size: 12.5px; }
.talk-sug { display: flex; gap: 8px; padding: 2px 12px 9px; flex-wrap: wrap; }
.talk-sug[hidden] { display: none; }
/* three things you might say: each on its own strip of tape */
.talk-sug button {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer;
  font: 700 13.5px/1.2 var(--body); color: var(--brown-deep);
  min-height: 36px; padding: 6px 16px 7px; max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.talk-sug button:nth-child(odd) { transform: rotate(-1deg); }
.talk-sug button:nth-child(even) { transform: rotate(0.8deg); }
.talk-sug button:active { filter: drop-shadow(0 1px 0 rgba(36, 21, 12, 0.35)) brightness(0.95); }
/* --- the lines Ben picks from (queue item 7c: typing is gone from play). Each on its own strip of tape, with its
   number on a key; they lie on the counter's edge where the text box was. One is marked (ui/talkchoices.js): the
   arrows, a controller's pad and a mouse move the mark, and Enter, Space or A say the marked line. */
.talk-choices {
  flex: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 7px;
  padding: 10px 12px 13px; border-top: 2px dashed rgba(90, 58, 34, 0.45); background: var(--paper-2); border-radius: 0 0 2px 2px;
}
.talk-choices[hidden] { display: none; }
.talk-choice {
  -webkit-appearance: none; appearance: none; border: 0; cursor: pointer; text-align: left;
  display: flex; align-items: center; gap: 10px; box-sizing: border-box; width: 100%;
  min-height: 44px; padding: 7px 18px 8px 12px;
  font: 700 15px/1.25 var(--body); color: var(--brown-deep);
  /* (paler than the tape of the old suggested lines: on the counter's darker edge each strip has to read as a thing
     to press, on a phone most of all, where there is no key and no mark to say so) */
  background-color: var(--paper);
}
.talk-choice:nth-child(odd) { transform: rotate(-0.45deg); }
.talk-choice:nth-child(even) { transform: rotate(0.35deg); }
/* (torn off the roll by hand: no two strips end at the same place) */
.talk-choice:nth-child(1) { margin-right: 8px; }
.talk-choice:nth-child(2) { margin-right: 22px; }
.talk-choice:nth-child(4) { margin-right: 14px; }
.talk-choice:nth-child(n) { width: auto; }
/* With the lines to pick from the panel may stand a little taller than it did with the text box (two lines more),
   and under a favor's ticket the lines lie two to a row, so the ticket, their words and the lines are all in view. */
.talk.picks .talk-card { max-height: min(66vh, 480px); }
.talk-offer:not([hidden]) ~ .talk-choices { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; }
.talk-offer:not([hidden]) ~ .talk-choices .talk-choice { margin-right: 0; }
.talk-offer:not([hidden]) ~ .talk-choices .talk-choice:last-child:nth-child(odd) { grid-column: 1 / -1; }
.talk-choice .key { flex: none; margin: 0; top: -1px; min-width: 1.75em; font-size: 13px; }
.talk-choice-line { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
/* the kind of reply, where a scene gives one: stamped, like the stage in the head */
.talk-choice-tone {
  flex: none; font: 900 10px/1 var(--body); letter-spacing: 0.12em; text-transform: uppercase;
  padding: 4px 6px 3px; border: 2px solid currentColor; border-radius: 3px; transform: rotate(-3deg);
}
.tone-nice .talk-choice-tone { color: var(--green-deep); }
.tone-funny .talk-choice-tone { color: #8a5200; }
.tone-mischief .talk-choice-tone { color: var(--red-deep); }
/* the mark: the strip comes up white, its key goes gold, and the line is underlined in the office's red marker */
.talk-choice.is-on { background-color: #fffdf6; filter: drop-shadow(0 4px 0 rgba(36, 21, 12, 0.55)); }
.talk-choice.is-on .key { background: var(--gold); }
.talk-choice.is-on .talk-choice-line { text-decoration: underline 3px var(--red); text-underline-offset: 4px; }
.talk-choice:active:not(:disabled) { filter: drop-shadow(0 1px 0 rgba(36, 21, 12, 0.35)) brightness(0.95); }
.talk-choice:disabled { cursor: default; opacity: 0.55; }
/* a line that is shown and cannot be said */
.talk-choice.off { opacity: 0.45; filter: grayscale(1); font-style: italic; }
.talk-yes.is-on, .talk-no.is-on { outline: 3px solid var(--gold); outline-offset: 2px; }
/* a finger needs no key and no mark */
body.touch-ui .talk-choice .key { display: none; }
body.touch-ui .talk-choice { padding-left: 16px; }
body.touch-ui .talk-choice.is-on { background-color: var(--paper); filter: drop-shadow(0 3px 0 rgba(36, 21, 12, 0.35)); }
body.touch-ui .talk-choice.is-on .talk-choice-line { text-decoration: none; }
/* a speaker with no friendship to show (a story scene's): no stamp and no meter */
.talk.plain .talk-stage, .talk.plain .talk-meter { display: none; }
.talk.plain .talk-close { margin-left: auto; }
.talk-close[hidden], .talk-form[hidden] { display: none; }
.talk-form { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 10px 12px; border-top: 2px dashed rgba(90, 58, 34, 0.45); background: var(--paper-2); border-radius: 0 0 2px 2px; }
.talk-input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; box-sizing: border-box;
  font: 700 16px/1.2 var(--body); color: var(--brown-deep);
  background: var(--white); border: 3px solid var(--brown-deep); border-radius: 5px; padding: 8px 10px;
  box-shadow: inset 0 3px 0 rgba(36, 21, 12, 0.1);
  -webkit-user-select: text; user-select: text; touch-action: manipulation;
  -webkit-appearance: none; appearance: none; outline: none;
}
.talk-input::placeholder { color: #a89474; font-style: italic; }
.talk-input:focus { border-color: var(--green-deep); box-shadow: inset 0 3px 0 rgba(36, 21, 12, 0.1), 0 0 0 3px rgba(47, 125, 79, 0.3); }
.talk-count { flex: none; font: 900 11px/1 var(--mono); color: #9a8468; font-variant-numeric: tabular-nums; min-width: 22px; text-align: right; }
.talk-count.low { color: var(--red); }
.talk-send { flex: none; min-height: 44px; padding: 0 18px; font-size: 13.5px; }

/* while talking or on the phone, the game's own controls step back */
body.talking .touch, body.talking .hud-hint, body.talking .hud-prompt, body.phoning .touch, body.phoning .hud-hint, body.phoning .hud-prompt { display: none; }

/* short screens (a phone on its side, or the keyboard up): keep the essentials */
@media (max-height: 430px) {
  .talk-card { max-height: 88vh; }
  .talk-card::before { height: 8px; background-size: 24px 24px; }
  .talk-log { font-size: 14.5px; padding-top: 12px; }
  .talk-head { padding-top: 3px; padding-bottom: 3px; min-height: 40px; }
  .talk-hello { margin-top: -16px; margin-bottom: -6px; }
  .talk-hello b { font-size: 12px; }
  .talk-name { --sign: 22px; }
  .talk-form { padding: 6px 8px 8px; }
  .talk-offer { margin-bottom: 6px; padding-top: 5px; padding-bottom: 5px; }
  /* the lines side by side, two to a row (an odd one out takes a whole row) */
  .talk-choices { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 6px 10px; padding: 7px 10px 9px; }
  .talk-choice { min-height: 40px; font-size: 14px; padding-top: 5px; padding-bottom: 6px; }
  .talk-choice:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .talk-choice:nth-child(n) { margin-right: 0; }
  .talk.picks .talk-card { max-height: 92vh; }
  /* (and the ticket's two answers go up beside its title, with the ask under them: a row saved for the lines) */
  .talk.picks .talk-offer-what { order: 1; }
  .talk.picks .talk-offer-answers { order: 2; }
  .talk.picks .talk-offer-ask { order: 3; }
  .talk.picks .talk-yes, .talk.picks .talk-no { min-height: 40px; }
}
@media (max-width: 520px) {
  /* upright there is height to spare, and the ticket and the tape need it */
  .talk-card { max-height: min(64vh, 540px); }
  .talk-hello { max-width: 56%; }
  .talk-name { --sign: 23px; min-width: 70px; }
  .talk-offer-answers { flex: 1 1 100%; }
  .talk-yes, .talk-no { flex: 1 1 0; }
  .talk-choice { min-height: 48px; }
  .talk.picks .talk-card { max-height: min(72vh, 600px); }
  /* (upright there is no width for two to a row: under a ticket the lines stay one to a row) */
  .talk-offer:not([hidden]) ~ .talk-choices { grid-template-columns: minmax(0, 1fr); }
  .talk-offer:not([hidden]) ~ .talk-choices .talk-choice:last-child:nth-child(odd) { grid-column: auto; }
}
.talk.kb .talk-sug { display: none; }
.talk.kb .talk-card { max-height: calc(var(--vvh, 100vh) - 8px); }
