/* Tea Cup Ride. The gate's tokens, sets and buttons (../../assets/gate.css), plus this. */

[hidden] { display: none !important; }

.tc-bar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  width: min(760px, 100% - 24px);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 0 10px;
}
.tc-back {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 13px 8px 11px;
  border-radius: 8px;
  background: var(--sign);
  color: var(--sign-ink);
  font: 800 1rem/1 var(--f-sign);
  text-decoration: none;
  box-shadow: inset 0 0 0 3px var(--sign), inset 0 0 0 5px var(--sign-ink), 0 5px 0 -2px var(--sign-deep);
}
.tc-back:hover { background: var(--sign-hi); }
.tc-back svg { width: 16px; height: 16px; fill: currentColor; transform: rotate(180deg); }
#sound { justify-self: end; font-size: 1.15rem; padding: 8px 12px 7px; }

/* the name in the banner's letters, in Uncle Brewster's cream glaze with his rosy cheeks under it; the U of CUP
   turns now and then, as a cup on the ride turns */
.tc-title { margin: 0; font: 400 clamp(1.1rem, 4.6vw, 2.4rem)/1 var(--f-toy); white-space: nowrap; }
.tct { display: inline-flex; gap: .01em; }
.tct > span {
  display: inline-block;
  color: #f3e6c8;
  text-shadow:
    -.015em -.015em 0 #fffaf0,
    .01em .02em 0 #c9667e, .02em .04em 0 #c9667e, .03em .06em 0 #b4566e, .04em .08em 0 #9a4660,
    .06em .15em .1em rgba(6, 3, 18, .65);
}
.tct > .tct-gap { width: .32em; }
.tct > .tct-spin { animation: tc-spin 5.2s ease-in-out infinite; }
@keyframes tc-spin {
  0%, 70%, 100% { transform: none; }
  78% { transform: scaleX(-1); }
  86% { transform: scaleX(1); }
}

.tc-main {
  display: grid;
  justify-items: center;
  width: min(760px, 100% - 24px);
  margin: 0 auto;
  padding-bottom: 20px;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.tc-set { width: auto; padding: 14px 14px 46px; }
.tc-screen {
  aspect-ratio: 9 / 16;
  height: min(72vh, 700px);
  width: auto;
  border-radius: 16px / 20px;
  touch-action: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;   /* no flash over the game on a phone when it is pressed */
  container-type: size;   /* the cards size their text by the screen's height (cqh) */
}
.tc-screen canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; image-rendering: crisp-edges; }
.tc-ch { top: 10px; left: 12px; }
.tc-score { top: 10px; right: 12px; transition: transform .12s; }
.tc-score.bump { transform: scale(1.25); }
@keyframes tc-hit { 0%, 100% { transform: none; color: inherit; } 25%, 75% { transform: translateX(-3px); color: #ff6b7d; } 50% { transform: translateX(3px); color: #ff6b7d; } }

/* a sign when one of his funny mugs joins the ride: the town's brown sign */
.tc-street {
  position: absolute;
  top: 17%;
  left: 50%;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 10px 16px 9px;
  border-radius: 8px;
  background: var(--sign);
  color: var(--sign-ink);
  box-shadow: inset 0 0 0 3px var(--sign), inset 0 0 0 5px var(--sign-ink), 0 5px 0 -2px var(--sign-deep), 0 10px 24px rgba(0, 0, 0, .5);
  transform: translate(-50%, 0);
  pointer-events: none;
  white-space: nowrap;
}
.tc-street.in { animation: tc-street 2.8s steps(14) 1 both; }
@keyframes tc-street {
  0% { opacity: 0; transform: translate(-50%, -14px); }
  12%, 82% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); }
}
.tc-street-no { font: 400 .95rem/1 var(--f-osd); letter-spacing: .14em; opacity: .8; }
.tc-street-name { font: 800 clamp(1.05rem, 4.6vw, 1.45rem)/1 var(--f-sign); }
.tc-street-where { font: 400 .95rem/1 var(--f-osd); letter-spacing: .06em; opacity: .85; }
.tc-sub {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 3.5%;
  z-index: 3;
  margin: 0;
  text-align: center;
  font: 400 clamp(1.2rem, 4.4vw, 1.6rem)/1.15 var(--f-osd);
  color: #fff;
  text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000;
  pointer-events: none;
}

.tc-card {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 18px;
  text-align: center;
  background: rgba(10, 7, 24, .66);
  cursor: default;
}
.tc-play {
  padding: 10px 22px 8px;
  border: 2px solid #5b4d91;
  border-radius: 6px;
  background: #1b1634;
  color: #fff;
  font: 400 clamp(1.7rem, 6vw, 2.2rem)/1 var(--f-osd);
  font-size: clamp(1.25rem, 6cqh, 2.2rem);
  letter-spacing: .08em;
  white-space: nowrap;
  cursor: pointer;
  box-shadow: 0 3px 0 #0a0816, 0 0 24px rgba(232, 160, 180, .25);
}
.tc-play:hover { border-color: #e8a0b4; }
.tc-play:active { transform: translateY(2px); box-shadow: 0 1px 0 #0a0816; }
.tc-hint { margin: 0; max-width: 25ch; font: 400 1.25rem/1.2 var(--f-osd); font-size: clamp(.95rem, 4.2cqh, 1.25rem); color: var(--ink); text-shadow: 2px 2px 0 #000; }
.tc-lore { color: var(--cream); }
.tc-over-title { margin: 0; max-width: 13ch; font-size: clamp(1.45rem, 5.4vw, 2.2rem); }
.tc-over-line { margin: 0; max-width: 24ch; font: 400 clamp(1.25rem, 4.2vw, 1.5rem)/1.2 var(--f-osd); color: var(--ink); text-shadow: 2px 2px 0 #000; }
.tc-over-stats { margin: 0; font: 400 1.15rem/1.2 var(--f-osd); letter-spacing: .03em; color: var(--muted); text-shadow: 2px 2px 0 #000; }
.tc-over-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 4px; }
.tc-share { align-self: stretch; }

/* one wide button under the set: pour, held */
.tc-pad {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  width: min(420px, 100%);
  margin: 14px auto 0;
}
.tc-pad button {
  height: 62px;
  border: 2px solid #3b3263;
  border-radius: 12px;
  background: #1b1634;
  color: var(--ink);
  font: 400 1.6rem/1 var(--f-osd);
  letter-spacing: .1em;
  box-shadow: 0 4px 0 #0a0816;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}
.tc-pad button:hover { border-color: #5b4d91; }
.tc-pad [data-d="pour"] { color: #f3e6c8; border-color: #7a4a5a; }
.tc-pad button:active, .tc-pad button.on { transform: translateY(3px); box-shadow: 0 1px 0 #0a0816; border-color: #e8a0b4; color: #fffaf0; }
.tc-hint-touch { display: none; }
@media (pointer: coarse) {
  .tc-hint-keys { display: none; }
  .tc-hint-touch { display: block; }
}
.tc-stats { margin: 12px 0 0; font: 400 1.3rem/1.2 var(--f-osd); letter-spacing: .03em; color: var(--muted); text-align: center; }
.tc-about { max-width: 40ch; margin: 18px auto 0; text-align: center; }
.tc .foot a { color: var(--muted); text-decoration: none; }
.tc .foot a:hover { color: var(--ink); }

@media (pointer: coarse) {
  .tc-hint-keys { display: none; }
}

/* a phone held upright: the game is the whole screen and never scrolls */
@media (max-width: 599px) and (orientation: portrait) {
  html, body.tc { height: 100%; overscroll-behavior: none; }
  body.tc { display: flex; flex-direction: column; min-height: 100dvh; }
  .tc-bar { grid-template-columns: auto 1fr auto; width: calc(100% - 16px); gap: 8px; padding: max(8px, env(safe-area-inset-top)) 0 8px; }
  .tc-title { justify-self: center; font-size: clamp(1rem, 4.9vw, 1.5rem); }
  .tc-back { padding: 7px 9px 6px 8px; font-size: .9rem; gap: 5px; }
  .tc-back svg { width: 13px; height: 13px; }
  #sound { font-size: 1.1rem; padding: 7px 10px 6px; }
  body.tc { height: 100dvh; }
  .tc-main { flex: 1; min-height: 0; width: calc(100% - 16px); align-content: start; padding-bottom: 8px; touch-action: none; container-type: size; }
  .tc-set { padding: 8px 8px 30px; border-radius: 20px 20px 16px 16px; }
  .tc-set .tv-plate { left: 14px; bottom: 8px; font-size: .95rem; }
  .tc-set .tv-knob { right: 14px; bottom: 6px; width: 17px; height: 17px; }
  .tc-set .tv-knob-2 { right: 38px; bottom: 9px; width: 12px; height: 12px; }
  /* the screen takes all the height under the header: 128px is what else stands in .tc-main - the set's
     padding (38), the pad (62) and the best line (28); the first line is for browsers without container units */
  .tc-screen { height: min(calc(100dvh - 250px), calc((100vw - 32px) * 16 / 9)); }
  .tc-screen { height: min(calc(100cqh - 128px), calc((100cqw - 16px) * 16 / 9)); }
  .tc-ch, .tc-score { top: 8px; font-size: 1.25rem; }
  .tc-ch { left: 10px; } .tc-score { right: 10px; }
  .tc-pad { margin-top: 8px; }
  .tc-pad button { height: 54px; font-size: 1.35rem; }
  .tc-street { top: 17%; }
  .tc-stats { margin-top: 6px; font-size: 1.1rem; }
  .tc-about, .tc .foot { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .tct > .tct-spin { animation: none; }
}
