:root {
  --t: #1a1a1b;
  --navy: #0a253a;
  --blue: #24A0DA;
  --g: #24A0DA;
  --y: #c9b458;
  --x: #787c7e;
  --b: #d3d6da;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: #fff;
  color: var(--t);
  font-family: "Helvetica Neue", Arial, sans-serif;
}
.wrap {
  max-width: 500px;
  margin: 0 auto;
  padding: 8px 12px 40px;
}
.sub {
  text-align: center;
  color: var(--x);
  font-size: 13px;
  margin: 0 0 10px;
}
.frame {
  position: relative;
  width: 100%;
  max-width: 100%;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
  line-height: 0;
}
.frame img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
}
.arrow {
  position: absolute;
  width: 22px;
  height: 46px;
  margin-left: -11px;
  margin-top: -46px;
  pointer-events: none;
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 46'><path d='M11 46 L2 22 H8 V2 H14 V22 H20 Z' fill='%23c0392b' stroke='%23fff' stroke-width='1.5' stroke-linejoin='round'/></svg>") center / contain no-repeat;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,.55));
}
#log {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 5px;
  margin: 12px 0 10px;
}
.g-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--b);
  border-radius: 0;
  background: #fff;
  font-family: "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--t);
  user-select: none;
}
.g-row.empty {
  background: #fff;
  border-color: var(--b);
}
.g-row.ok {
  background: var(--g);
  border-color: var(--g);
  color: #fff;
}
.g-row.close {
  background: var(--y);
  border-color: var(--y);
  color: #fff;
}
.g-row.miss {
  background: var(--x);
  border-color: var(--x);
  color: #fff;
}
.g-name { min-width: 0; }
.g-lab {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .02em;
  opacity: .95;
}
.g-row.flip { animation: wx-flip .5s ease-in; }
.g-row.bounce { animation: wx-bounce 1s; }
#guess-form {
  display: flex;
  gap: 6px;
}
#guess {
  flex: 1;
  min-width: 0;
  height: 58px;
  min-height: 58px;
  border: 2px solid var(--b);
  border-radius: 4px;
  padding: 0 14px;
  font-family: Montserrat, "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-size: 16px;
  color: var(--navy);
  background: #fff;
}
#guess::placeholder { color: #878a8c; }
#guess-btn {
  height: 58px;
  min-height: 58px;
  min-width: 88px;
  padding: 0 16px;
  background: #0a253a;
  color: #fff;
  border: 0;
  border-radius: 4px;
  font-family: Montserrat, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .04em;
  text-transform: uppercase;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#guess-btn:disabled,
#guess:disabled {
  opacity: .55;
  cursor: default;
}
#suggest {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  border: 2px solid var(--b);
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
}
#suggest:empty { display: none; border: 0; }
#suggest button {
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: left;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid var(--b);
  background: #fff;
  color: var(--t);
  font-family: Montserrat, "Helvetica Neue", Arial, sans-serif;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
#suggest li:last-child button { border-bottom: 0; }
#suggest button:hover,
#suggest button:focus { background: #f4f6f8; }
#ov {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 40;
  padding: 16px;
}
#ov.show { display: flex; }
#modal {
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 23px rgba(0,0,0,.2);
  width: min(500px, 94vw);
  max-height: 92vh;
  overflow: auto;
  padding: 20px 16px;
  position: relative;
}
#close {
  position: absolute;
  right: 8px;
  top: 6px;
  border: 0;
  background: none;
  font-size: 22px;
  cursor: pointer;
  min-width: 44px;
  min-height: 44px;
}
#mc h2 {
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: center;
  margin: 8px 0;
}
.ans { text-align: center; font-size: 20px; font-weight: 800; color: var(--navy); margin: 4px 0; }
.explain { text-align: center; font-size: 14px; color: #444; margin: 0 0 12px; }
.stats { display: flex; justify-content: center; }
.stats div { flex: 1; text-align: center; max-width: 80px; }
.stats b { display: block; font-size: 32px; font-weight: 400; }
.stats span { font-size: 11px; color: var(--x); }
#share {
  display: block;
  margin: 14px auto;
  background: var(--blue);
  color: #fff;
  border: 0;
  border-radius: 24px;
  font-weight: 700;
  font-size: 16px;
  padding: 12px 28px;
  cursor: pointer;
  min-height: 44px;
}
.pearl {
  display: block;
  text-align: center;
  margin: 10px 0;
  color: var(--blue);
  font-weight: 700;
}
.next a {
  display: block;
  text-align: center;
  padding: 11px 12px;
  border: 1px solid var(--b);
  border-radius: 4px;
  margin: 6px 0;
  color: var(--t);
  text-decoration: none;
  font-weight: 700;
}
.tag { font-size: 11px; color: var(--x); text-align: center; margin-top: 12px; }
.tag a { color: var(--x); }
.toast {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--t);
  color: #fff;
  padding: 10px 14px;
  border-radius: 4px;
  font-weight: 700;
  z-index: 50;
}
