:root {
  color-scheme: light;
  --ink: #3b3a32;
  --soft-ink: #786f63;
  --panel: rgba(255, 252, 233, 0.78);
  --panel-strong: rgba(255, 252, 236, 0.92);
  --line: rgba(134, 105, 82, 0.16);
  --leaf: #5fab6b;
  --mint: #c7efd0;
  --gold: #f2b84b;
  --rose: #f0919d;
  --blue: #7bc4df;
  --violet: #aa8ee8;
  --shadow: 0 18px 34px rgba(68, 82, 62, 0.18);
  --pop-shadow: 0 10px 18px rgba(93, 101, 62, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  color: var(--ink);
  background: #a8dde1;
  font-family:
    "Pretendard Variable", Pretendard, "SUIT Variable", SUIT, ui-rounded, "SF Pro Rounded", "Avenir Next Rounded", "Apple SD Gothic Neo", "Malgun Gothic",
    system-ui, sans-serif;
  font-size: 16px;
}

button {
  font: inherit;
}

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: grab;
  touch-action: none;
}

#scene:active {
  cursor: grabbing;
}

.light-wash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.2), transparent 18%),
    radial-gradient(circle at 22% 16%, rgba(255, 225, 150, 0.24), transparent 16rem),
    radial-gradient(circle at 76% 70%, rgba(118, 177, 203, 0.16), transparent 22rem),
    linear-gradient(to bottom, transparent 62%, rgba(39, 77, 67, 0.08));
}

.topbar,
.village-panel,
.social-panel,
.tile-panel,
.tool-dock,
.daybar,
.log,
.update-notice,
.account-modal,
.friend-modal {
  position: fixed;
  z-index: 5;
}

.topbar {
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  pointer-events: none;
}

.brand,
.stats,
.village-panel,
.tile-panel,
.tool-dock,
.daybar,
.log {
  pointer-events: auto;
}

.brand {
  display: flex;
  min-width: 248px;
  align-items: center;
  gap: 11px;
  padding: 10px 14px 12px 11px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.82), rgba(255, 245, 203, 0.7)),
    rgba(255, 249, 228, 0.64);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.brand-mark {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.76);
  border-radius: 50%;
  color: #fff9c7;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.9), transparent 18%),
    linear-gradient(145deg, #64b86a, #2f7e54);
  box-shadow:
    inset 0 -5px 0 rgba(30, 83, 49, 0.2),
    0 10px 20px rgba(42, 90, 54, 0.22);
  font-size: 1.35rem;
  font-weight: 900;
}

.brand p {
  margin: 0 0 4px;
  color: #5b775e;
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.track-brand-title {
  display: none;
  width: fit-content;
  margin-top: 7px;
  padding: 5px 9px 6px;
  border: 1px solid rgba(224, 129, 118, 0.24);
  border-radius: 999px;
  color: #b85f6e;
  background: linear-gradient(135deg, rgba(255, 239, 204, 0.88), rgba(255, 213, 188, 0.64));
  box-shadow: inset 0 -2px 0 rgba(129, 84, 46, 0.08);
  font-size: 0.9rem;
  font-weight: 950;
  line-height: 1;
}

body.track-mode .track-brand-title {
  display: block;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4.2vw, 4.2rem);
  line-height: 0.92;
  letter-spacing: 0;
  white-space: nowrap;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 1fr));
  gap: 8px;
  width: min(470px, 47vw);
}

.stat {
  display: grid;
  grid-template-columns: 34px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  min-width: 0;
  align-items: center;
  padding: 9px 11px 10px 9px;
  border: 1px solid rgba(255, 255, 255, 0.66);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.9), rgba(255, 248, 220, 0.78)),
    var(--panel-strong);
  box-shadow: var(--pop-shadow);
  backdrop-filter: blur(12px);
}

.stat i {
  display: grid;
  grid-row: 1 / 3;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--gold);
  box-shadow: inset 0 -4px 0 rgba(72, 48, 28, 0.16);
  font-style: normal;
  font-size: 1rem;
  line-height: 1;
}

.stat:nth-child(2) i {
  background: var(--rose);
}

.stat:nth-child(3) i {
  background: var(--violet);
}

.stat:nth-child(4) i {
  background: #5bbf8b;
}

.stat span {
  display: block;
  color: var(--soft-ink);
  font-size: 0.75rem;
  font-weight: 900;
}

.stat strong {
  display: block;
  font-size: 1.38rem;
  line-height: 1;
}

.village-panel {
  top: 124px;
  right: 18px;
  width: 280px;
  max-height: 330px;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.72), rgba(255, 243, 211, 0.62)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.social-panel {
  top: 470px;
  right: 18px;
  display: grid;
  gap: 10px;
  width: 280px;
  max-height: calc(100vh - 590px);
  min-height: 210px;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background:
    linear-gradient(160deg, rgba(255, 255, 255, 0.74), rgba(225, 246, 232, 0.62)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.social-section > span {
  display: block;
  margin-bottom: 7px;
  font-size: 0.84rem;
  font-weight: 900;
}

.social-panel ul,
.social-panel ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

#playerList,
#friendList,
#chatLog {
  display: grid;
  gap: 6px;
}

#playerList li,
#friendList li,
#chatLog li {
  padding: 7px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 -2px 0 rgba(78, 92, 55, 0.06);
  font-size: 0.9rem;
  font-weight: 800;
  line-height: 1.28;
}

#playerList li {
  display: flex;
  align-items: center;
  gap: 7px;
}

#playerList i {
  display: grid;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff5bf, #75cc75);
  font-style: normal;
}

#friendList button {
  display: grid;
  gap: 2px;
  width: 100%;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font-weight: 900;
  text-align: left;
}

#friendList small {
  color: rgba(55, 72, 58, 0.68);
  font-size: 0.74rem;
  font-weight: 900;
}

#friendList em {
  color: rgba(55, 72, 58, 0.58);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.chat-section {
  min-height: 0;
}

#chatLog {
  max-height: 118px;
  overflow: auto;
}

#chatLog small {
  display: block;
  color: var(--soft-ink);
  font-size: 0.68rem;
  font-weight: 900;
}

#chatForm {
  display: flex;
  gap: 6px;
  margin-top: 7px;
}

#chatInput,
#playerName {
  width: 100%;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(65, 86, 69, 0.2);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 750;
}

#chatForm button {
  display: grid;
  flex: 0 0 38px;
  width: 38px;
  place-items: center;
  border: 1px solid rgba(60, 82, 66, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(145deg, #efffcf, #75cc75);
  cursor: pointer;
  font-weight: 900;
}

.villager {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.villager strong,
.quest span,
.buildings span,
.seeds span,
.tile-panel span {
  display: block;
  font-size: 0.84rem;
  font-weight: 900;
}

.villager p,
.tile-panel p {
  margin: 3px 0 0;
  color: var(--soft-ink);
  font-size: 0.88rem;
  line-height: 1.38;
}

.avatar {
  display: grid;
  flex: 0 0 54px;
  width: 54px;
  height: 54px;
  place-items: center;
  border-radius: 50%;
  background: #f1c780;
  box-shadow: inset 0 -5px 0 rgba(128, 79, 31, 0.08);
}

.avatar span {
  width: 39px;
  height: 34px;
  border-radius: 45% 45% 50% 50%;
  background:
    radial-gradient(circle at 33% 46%, #26342d 0 5%, transparent 6%),
    radial-gradient(circle at 67% 46%, #26342d 0 5%, transparent 6%),
    radial-gradient(ellipse at 50% 72%, #bb6662 0 8%, transparent 9%),
    #f7d7a8;
}

.quest,
.buildings,
.seeds {
  margin-top: 13px;
}

.quest {
  padding: 11px;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(217, 244, 164, 0.72), rgba(168, 224, 192, 0.4)),
    rgba(181, 222, 165, 0.36);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.44);
}

.quest strong {
  display: block;
  margin-top: 3px;
  font-size: 1.02rem;
}

.buildings ul,
.seeds ul,
.log {
  margin: 0;
  padding: 0;
  list-style: none;
}

.buildings ul,
.seeds ul {
  display: grid;
  gap: 7px;
  margin-top: 8px;
}

.buildings li,
.seeds li {
  min-height: 38px;
  padding: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 -2px 0 rgba(78, 92, 55, 0.06);
  font-size: 0.9rem;
  font-weight: 850;
  overflow: hidden;
}

.buildings li.done,
.seeds li.done {
  background: linear-gradient(135deg, rgba(210, 240, 157, 0.72), rgba(179, 221, 136, 0.45));
}

.buildings li.selected,
.seeds li.selected {
  outline: 2px solid rgba(80, 170, 84, 0.72);
  background: linear-gradient(135deg, rgba(226, 255, 191, 0.88), rgba(255, 242, 166, 0.72));
}

.buildings li.locked-cost small,
.seeds li.locked-cost small {
  color: #a0524c;
  background: rgba(255, 224, 213, 0.78);
}

.buildings button,
.seeds button {
  display: flex;
  width: 100%;
  min-height: 42px;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 8px 7px 7px;
  border: 0;
  color: inherit;
  background: transparent;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.buildings button:disabled,
.seeds button:disabled {
  cursor: default;
}

.buildings li span,
.seeds li span {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 7px;
  line-height: 1.2;
}

.buildings li i,
.seeds li i {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: inset 0 -3px 0 rgba(55, 66, 38, 0.08);
  font-style: normal;
  font-size: 0.95rem;
}

.buildings small,
.seeds small {
  flex: 0 1 auto;
  padding: 4px 7px;
  border-radius: 999px;
  color: var(--soft-ink);
  background: rgba(255, 255, 255, 0.64);
  font-size: 0.8rem;
  font-weight: 900;
  line-height: 1.2;
  text-align: right;
  white-space: normal;
}

.tile-panel {
  display: flex;
  left: 18px;
  bottom: 116px;
  width: min(332px, calc(100vw - 36px));
  align-items: center;
  gap: 11px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.74), rgba(255, 247, 215, 0.62)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.tile-panel > i {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.72);
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 25%, rgba(255, 255, 255, 0.92), transparent 17%),
    linear-gradient(145deg, #9bdd75, #4a9a62);
  box-shadow:
    inset 0 -5px 0 rgba(51, 91, 45, 0.18),
    0 10px 20px rgba(43, 72, 42, 0.16);
  font-style: normal;
  font-size: 1.35rem;
}

.tile-panel strong {
  display: block;
  margin-top: 3px;
  font-size: 1.18rem;
}

.tool-dock {
  left: 50%;
  bottom: 18px;
  display: grid;
  grid-template-columns: repeat(7, minmax(68px, 1fr));
  gap: 8px;
  width: min(740px, calc(100vw - 244px));
  padding: 9px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(255, 240, 200, 0.62)),
    rgba(255, 249, 228, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transform: translateX(-50%);
}

.tool {
  display: grid;
  min-width: 0;
  min-height: 72px;
  place-items: center;
  gap: 3px;
  padding: 7px 6px 8px;
  border: 1px solid rgba(60, 82, 66, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(245, 239, 211, 0.72)),
    rgba(255, 255, 255, 0.58);
  box-shadow:
    inset 0 -4px 0 rgba(78, 86, 52, 0.08),
    0 8px 14px rgba(45, 62, 42, 0.08);
  cursor: pointer;
  transition:
    transform 0.14s ease,
    background 0.14s ease,
    border-color 0.14s ease,
    box-shadow 0.14s ease;
}

.tool:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.86);
}

.tool.active {
  border-color: rgba(57, 128, 87, 0.72);
  background:
    linear-gradient(180deg, #f1ffd7, #ccefa4),
    #dff1c5;
  box-shadow:
    inset 0 0 0 2px rgba(57, 128, 87, 0.14),
    inset 0 -5px 0 rgba(70, 125, 61, 0.12),
    0 11px 18px rgba(57, 128, 87, 0.18);
}

.tool i {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #ffffff, #dcefc8);
  box-shadow: inset 0 -4px 0 rgba(55, 76, 40, 0.1);
  font-style: normal;
  font-size: 1.08rem;
  line-height: 1;
}

.tool-water i {
  background: linear-gradient(145deg, #dffaff, #72c5dc);
}

.tool-plant i {
  background: linear-gradient(145deg, #efffcf, #75cc75);
}

.tool-harvest i {
  background: linear-gradient(145deg, #fff2c4, #e4a344);
}

.tool-clear i {
  background: linear-gradient(145deg, #ffe6ce, #c9874e);
}

.tool-plot i {
  background: linear-gradient(145deg, #f1d4aa, #b77d4f);
}

.tool-build i {
  background: linear-gradient(145deg, #ffe3d8, #e58c68);
}

.tool-pond i {
  background: linear-gradient(145deg, #e4fbff, #62b9d3);
}

.tool span {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.78rem;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.daybar {
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 8px;
}

.round-button,
.day-button {
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 241, 203, 0.78)),
    var(--panel-strong);
  box-shadow: var(--shadow);
  cursor: pointer;
  backdrop-filter: blur(16px);
  transition:
    transform 0.14s ease,
    background 0.14s ease;
}

.round-button:hover,
.day-button:hover {
  transform: translateY(-2px);
  background: #fffef4;
}

.round-button {
  width: 56px;
  min-height: 56px;
  font-size: 1.25rem;
  font-weight: 900;
  box-shadow:
    var(--shadow),
    inset 0 -4px 0 rgba(91, 70, 34, 0.08);
}

.day-button {
  display: flex;
  min-width: 132px;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
}

.day-button i {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff6c5, #efbd4d);
  box-shadow: inset 0 -4px 0 rgba(116, 73, 25, 0.12);
  font-style: normal;
  font-size: 1.2rem;
}

.day-button strong {
  font-size: 0.96rem;
}

.friend-button {
  background:
    linear-gradient(180deg, rgba(241, 255, 225, 0.96), rgba(205, 238, 164, 0.8)),
    var(--panel-strong);
}

.visiting .friend-button {
  border-color: rgba(80, 143, 224, 0.66);
  background:
    linear-gradient(180deg, rgba(229, 248, 255, 0.98), rgba(150, 211, 232, 0.82)),
    var(--panel-strong);
}

.account-button {
  background:
    linear-gradient(180deg, rgba(255, 238, 248, 0.96), rgba(238, 196, 229, 0.8)),
    var(--panel-strong);
}

.update-notice {
  right: 18px;
  bottom: 18px;
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px 12px;
  width: min(390px, calc(100vw - 36px));
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.94), rgba(230, 250, 229, 0.86)),
    var(--panel-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  z-index: 24;
}

.update-notice.visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.update-notice > i {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #72c676, #3d8f5f);
  box-shadow: inset 0 -4px 0 rgba(36, 78, 48, 0.16);
  font-style: normal;
  font-weight: 900;
}

.update-notice span,
.update-notice small {
  display: block;
  color: var(--soft-ink);
  font-size: 0.72rem;
  font-weight: 900;
}

.update-notice strong {
  display: block;
  margin-top: 2px;
  font-size: 1.02rem;
  line-height: 1.05;
}

.update-notice p {
  margin: 4px 0 0;
  color: var(--soft-ink);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.24;
}

.update-notice small {
  margin-top: 4px;
  font-size: 0.66rem;
}

.update-notice div:last-child {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 0.75fr 1.25fr;
  gap: 8px;
}

.update-notice button {
  min-height: 38px;
  border: 1px solid rgba(60, 82, 66, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 900;
}

.update-notice button:last-child {
  background: linear-gradient(145deg, #efffcf, #75cc75);
}

.update-notice button:disabled {
  cursor: wait;
  opacity: 0.64;
}

.account-modal,
.friend-modal {
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(31, 53, 44, 0.24);
  backdrop-filter: blur(6px);
}

body.auth-locked {
  background:
    radial-gradient(circle at 50% 28%, rgba(255, 245, 183, 0.72), transparent 18rem),
    linear-gradient(180deg, #bfe8dd, #f7eec6 58%, #add7d5);
}

body.auth-locked #scene,
body.auth-locked .light-wash,
body.auth-locked .topbar,
body.auth-locked .village-panel,
body.auth-locked .social-panel,
body.auth-locked .tile-panel,
body.auth-locked .tool-dock,
body.auth-locked .daybar,
body.auth-locked .log {
  display: none;
}

body.auth-locked .account-modal {
  background:
    radial-gradient(circle at 50% 18%, rgba(255, 255, 255, 0.72), transparent 16rem),
    linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(88, 143, 110, 0.1));
  backdrop-filter: none;
}

body.auth-locked .account-card {
  width: min(460px, calc(100vw - 32px));
  padding: 24px 22px 20px;
}

body.auth-locked .account-card::before {
  display: block;
  margin-bottom: 12px;
  color: #4f8f5b;
  content: "흥래랜드";
  font-family: "Pretendard Variable", Pretendard, "SUIT Variable", SUIT, ui-rounded, "SF Pro Rounded", "Apple SD Gothic Neo", system-ui, sans-serif;
  font-size: clamp(2.5rem, 12vw, 4.6rem);
  line-height: 0.95;
  text-align: center;
  text-shadow:
    0 3px 0 #fff7cf,
    0 8px 0 rgba(93, 132, 72, 0.1);
}

body.auth-locked .account-card::after {
  display: block;
  margin-top: 12px;
  color: #7b735f;
  content: "로그인 후 내 마을로 입장합니다.";
  font-weight: 900;
  text-align: center;
}

body.auth-locked .account-card .friend-head {
  justify-content: center;
}

body.auth-locked .account-card .friend-head strong {
  font-size: 1.8rem;
}

body.account-busy .account-card {
  width: min(360px, calc(100vw - 32px));
  padding: 24px 20px;
  text-align: center;
}

body.auth-locked.account-busy .account-card::before,
body.auth-locked.account-busy .account-card::after,
body.account-busy .friend-close,
body.account-busy #villageName,
body.account-busy #accountEmail,
body.account-busy #accountPassword,
body.account-busy .account-actions {
  display: none;
}

body.account-busy .account-card .friend-head {
  justify-content: center;
  padding-right: 0;
}

body.account-busy .account-card .friend-head i {
  animation: accountPulse 1.05s ease-in-out infinite;
}

body.account-busy #accountStatus {
  margin: 14px 0 0;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 900;
}

body.account-signed-in .account-card {
  width: min(320px, calc(100vw - 32px));
  padding: 22px 18px 18px;
  text-align: center;
}

body.account-signed-in .account-card .friend-head {
  justify-content: center;
  padding-right: 0;
}

body.account-signed-in #accountStatus,
body.account-signed-in #villageName,
body.account-signed-in #accountEmail,
body.account-signed-in #accountPassword,
body.account-signed-in #googleSignIn,
body.account-signed-in #signUp,
body.account-signed-in #signIn {
  display: none;
}

body.account-signed-in .account-actions {
  grid-template-columns: 1fr;
  margin-top: 14px;
}

body.account-signed-in #signOut {
  display: flex;
}

@keyframes accountPulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.08);
  }
}

.account-modal.hidden,
.friend-modal.hidden {
  display: none;
}

.account-card,
.friend-card {
  position: relative;
  width: min(440px, calc(100vw - 36px));
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.76);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.88), rgba(255, 244, 207, 0.76)),
    var(--panel-strong);
  box-shadow: 0 26px 70px rgba(23, 44, 35, 0.32);
}

.friend-close {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(64, 83, 67, 0.14);
  border-radius: 50%;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
  cursor: pointer;
  font-size: 1.25rem;
  font-weight: 900;
}

.friend-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding-right: 38px;
}

.friend-head > i {
  display: grid;
  flex: 0 0 50px;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.94), transparent 18%),
    linear-gradient(145deg, #91d871, #67abc6);
  box-shadow:
    inset 0 -5px 0 rgba(34, 78, 74, 0.16),
    0 10px 20px rgba(44, 78, 65, 0.16);
  font-style: normal;
}

.friend-head span {
  display: block;
  color: var(--soft-ink);
  font-size: 0.78rem;
  font-weight: 900;
}

.friend-head strong {
  display: block;
  margin-top: 2px;
  font-size: 1.55rem;
  line-height: 1;
}

.friend-card p {
  margin: 14px 0 10px;
  color: var(--soft-ink);
  font-size: 0.92rem;
  font-weight: 750;
  line-height: 1.45;
}

.friend-card textarea {
  width: 100%;
  min-height: 54px;
  resize: vertical;
  padding: 11px;
  border: 1px solid rgba(65, 86, 69, 0.2);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.68);
  box-shadow: inset 0 2px 8px rgba(53, 70, 55, 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.36;
}

.friend-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.friend-actions button {
  display: flex;
  min-width: 0;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid rgba(60, 82, 66, 0.14);
  border-radius: 8px;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(245, 239, 211, 0.72)),
    rgba(255, 255, 255, 0.58);
  box-shadow:
    inset 0 -4px 0 rgba(78, 86, 52, 0.08),
    0 8px 14px rgba(45, 62, 42, 0.08);
  cursor: pointer;
  font-weight: 900;
}

.friend-actions button:disabled {
  cursor: default;
  opacity: 0.45;
}

.friend-actions i {
  display: grid;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #efffcf, #75cc75);
  font-style: normal;
}

.friend-actions span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Cuter visual pass */
.light-wash {
  background:
    linear-gradient(to bottom, rgba(255, 255, 255, 0.34), transparent 24%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 8px, transparent 8px 22px),
    linear-gradient(to bottom, transparent 58%, rgba(90, 128, 88, 0.1));
}

.brand,
.stat,
.village-panel,
.social-panel,
.tile-panel,
.tool-dock,
.log li,
.friend-card,
.round-button,
.day-button {
  border: 2px solid rgba(255, 255, 255, 0.86);
  outline: 1px solid rgba(117, 91, 70, 0.08);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 246, 218, 0.76)),
    var(--panel-strong);
  box-shadow:
    var(--shadow),
    inset 0 -5px 0 rgba(155, 125, 82, 0.08);
}

.brand {
  gap: 12px;
  padding: 11px 15px 13px 12px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.94), rgba(255, 235, 184, 0.82)),
    var(--panel-strong);
}

.brand-mark {
  color: #fff7ad;
  background:
    linear-gradient(145deg, #8bd96f, #58ad72 54%, #78c9df);
  box-shadow:
    inset 0 -6px 0 rgba(56, 112, 63, 0.18),
    0 8px 16px rgba(53, 94, 58, 0.18);
}

.brand p,
h1,
.stat strong,
.villager strong,
.quest strong,
.tile-panel strong,
.day-button strong,
.tool span,
.friend-head strong,
.social-section > span {
  font-family: "Pretendard Variable", Pretendard, "SUIT Variable", SUIT, ui-rounded, "SF Pro Rounded", "Apple SD Gothic Neo", system-ui, sans-serif;
}

h1 {
  color: #4f8f5b;
  text-shadow:
    0 2px 0 #fff7cf,
    0 5px 0 rgba(93, 132, 72, 0.1);
}

.brand p {
  color: #e07f8b;
  font-size: 0.78rem;
}

.stat {
  grid-template-columns: 38px 1fr;
  padding: 10px 12px 11px 10px;
}

.stat i,
.tool i,
.buildings li i,
.seeds li i,
.tile-panel > i,
.friend-head > i,
#playerList i,
.friend-actions i,
.day-button i {
  border: 2px solid rgba(255, 255, 255, 0.86);
  box-shadow:
    inset 0 -5px 0 rgba(92, 80, 56, 0.1),
    0 5px 10px rgba(63, 70, 45, 0.12);
}

.stat i {
  width: 38px;
  height: 38px;
  background: linear-gradient(145deg, #ffe68a, #f2b84b);
}

.stat:nth-child(2) i {
  background: linear-gradient(145deg, #ffc1cb, #f07183);
}

.stat:nth-child(3) i {
  background: linear-gradient(145deg, #cdb9ff, #8f7ad8);
}

.stat:nth-child(4) i {
  background: linear-gradient(145deg, #b9f5c6, #55bd7b);
}

.stat span,
.tile-panel span,
.quest span,
.buildings span,
.seeds span,
.social-section > span,
.friend-head span {
  color: #7b735f;
}

.village-panel,
.social-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(242, 255, 228, 0.72)),
    var(--panel);
}

.social-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(226, 248, 255, 0.72)),
    var(--panel);
}

.quest {
  background:
    linear-gradient(135deg, rgba(255, 236, 156, 0.76), rgba(194, 239, 172, 0.64)),
    rgba(255, 247, 196, 0.52);
}

.buildings li,
#playerList li,
#friendList li,
#chatLog li {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(255, 247, 224, 0.72));
  box-shadow:
    inset 0 -3px 0 rgba(133, 104, 67, 0.07),
    0 4px 8px rgba(72, 84, 57, 0.08);
}

.buildings li.done {
  background:
    linear-gradient(135deg, rgba(201, 245, 172, 0.84), rgba(255, 244, 173, 0.66));
}

.tile-panel {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(255, 229, 222, 0.74)),
    var(--panel);
}

.tile-panel > i {
  background: linear-gradient(145deg, #f7ffb7, #78cf6a 55%, #75c7df);
}

.tool-dock {
  padding: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(255, 239, 205, 0.76)),
    rgba(255, 252, 234, 0.82);
}

.tool {
  border: 2px solid rgba(255, 255, 255, 0.78);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(255, 250, 226, 0.78));
  box-shadow:
    inset 0 -6px 0 rgba(124, 99, 62, 0.08),
    0 8px 14px rgba(62, 82, 50, 0.1);
}

.tool:hover {
  transform: translateY(-3px) rotate(-1deg);
}

.tool.active {
  border-color: rgba(95, 171, 107, 0.76);
  background:
    linear-gradient(180deg, #fff8b7, #c9f3aa),
    #e5f5cd;
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.6),
    inset 0 -7px 0 rgba(91, 151, 73, 0.12),
    0 12px 20px rgba(84, 133, 76, 0.18);
}

.round-button,
.day-button,
.friend-actions button,
#chatForm button {
  font-family: "Pretendard Variable", Pretendard, "SUIT Variable", SUIT, ui-rounded, "SF Pro Rounded", "Apple SD Gothic Neo", system-ui, sans-serif;
}

.round-button:hover,
.day-button:hover,
.friend-actions button:hover,
#chatForm button:hover {
  transform: translateY(-3px) rotate(1deg);
}

.account-card input,
.friend-card textarea,
#chatInput,
#playerName {
  border: 2px solid rgba(255, 255, 255, 0.84);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 251, 230, 0.76));
  box-shadow: inset 0 3px 0 rgba(135, 105, 76, 0.05);
  font-family: "Pretendard Variable", Pretendard, "SUIT Variable", SUIT, ui-rounded, "SF Pro Rounded", "Apple SD Gothic Neo", system-ui, sans-serif;
}

.account-card input {
  display: block;
  margin-top: 8px;
}

.account-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.account-actions button {
  min-height: 54px;
  padding: 0 10px;
}

.account-actions span {
  font-size: 1.05rem;
}

.account-actions i {
  flex-basis: 30px;
  width: 30px;
  height: 30px;
}

.log {
  left: 18px;
  bottom: 232px;
  display: grid;
  gap: 6px;
  width: min(310px, calc(100vw - 36px));
}

.log li {
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.58);
  border-radius: 8px;
  color: var(--soft-ink);
  background: rgba(255, 249, 228, 0.68);
  box-shadow: 0 10px 22px rgba(30, 56, 47, 0.12);
  font-size: 0.84rem;
  font-weight: 750;
  line-height: 1.32;
  backdrop-filter: blur(14px);
}

.garage-panel,
.track-hud {
  position: fixed;
  z-index: 9;
  display: none;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.88), rgba(235, 247, 215, 0.78)),
    var(--panel-strong);
  box-shadow: 0 22px 54px rgba(23, 44, 35, 0.24);
  backdrop-filter: blur(16px);
}

.garage-panel {
  right: 18px;
  top: 116px;
  width: min(370px, calc(100vw - 36px));
  max-height: calc(100vh - 154px);
  overflow: auto;
  padding: 14px;
}

body.garage-open .garage-panel,
body.track-mode .track-hud {
  display: grid;
}

.garage-head,
.garage-preview,
.garage-actions,
.garage-colors {
  display: flex;
  align-items: center;
  gap: 10px;
}

.garage-head {
  justify-content: space-between;
}

.garage-head span,
.garage-part > span,
.garage-colors span,
.track-hud span {
  display: block;
  color: var(--soft-ink);
  font-size: 0.78rem;
  font-weight: 950;
}

.garage-head strong {
  font-size: 1.35rem;
}

.garage-head button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(49, 68, 48, 0.12);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.74);
  color: var(--ink);
  cursor: pointer;
  font-size: 1.4rem;
  font-weight: 950;
}

.garage-preview {
  margin-top: 12px;
  padding: 11px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.54);
}

.garage-preview i {
  display: grid;
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #fff7bf, #9ae680);
  font-style: normal;
  font-size: 1.55rem;
}

.garage-preview p {
  margin: 3px 0 0;
  color: var(--soft-ink);
  font-size: 0.86rem;
  font-weight: 850;
  line-height: 1.35;
}

.garage-parts {
  display: grid;
  gap: 12px;
  margin-top: 13px;
}

.garage-part {
  display: grid;
  gap: 7px;
}

.garage-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.garage-options button,
.garage-actions button {
  min-height: 44px;
  border: 1px solid rgba(68, 95, 63, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink);
  cursor: pointer;
  font-family: inherit;
  font-weight: 950;
  line-height: 1.2;
  box-shadow: inset 0 -4px 0 rgba(63, 80, 50, 0.06);
}

.garage-options button.active {
  border-color: rgba(72, 164, 80, 0.74);
  background: linear-gradient(150deg, #ecffd1, #fff3ad);
}

.garage-options small {
  display: block;
  margin-top: 3px;
  color: var(--soft-ink);
  font-size: 0.72rem;
}

.garage-colors {
  margin-top: 13px;
}

.garage-colors label {
  display: grid;
  flex: 1 1 0;
  gap: 5px;
}

.garage-colors input {
  width: 100%;
  height: 38px;
  padding: 3px;
  border: 1px solid rgba(69, 92, 61, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.78);
}

.garage-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
  margin: 13px 0 0;
}

.garage-stats div {
  padding: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
}

.garage-stats dt {
  color: var(--soft-ink);
  font-size: 0.72rem;
  font-weight: 950;
}

.garage-stats dd {
  margin: 2px 0 0;
  font-size: 1rem;
  font-weight: 950;
}

.garage-actions {
  margin-top: 13px;
}

.garage-actions button {
  flex: 1 1 0;
}

.track-hud {
  left: 18px;
  right: 18px;
  bottom: 18px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.track-hud-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.track-hud strong {
  display: block;
  font-size: 1.45rem;
}

.track-hud p {
  margin: 2px 0 0;
  color: var(--soft-ink);
  font-size: 0.84rem;
  font-weight: 850;
}

.track-home {
  display: inline-flex;
  flex: 0 0 auto;
  min-width: 82px;
  height: 48px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid rgba(52, 74, 51, 0.16);
  border-radius: 8px;
  color: var(--ink);
  background: linear-gradient(180deg, #ffffff, #e4f6d8);
  box-shadow: inset 0 -4px 0 rgba(48, 68, 48, 0.08);
  cursor: pointer;
  font-family: inherit;
  font-weight: 950;
}

.track-home i {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: #fff8c6;
  background: linear-gradient(145deg, #68bf70, #3c8a5d);
  font-style: normal;
}

.track-home span {
  color: var(--ink);
  font-size: 0.86rem;
}

.race-times {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.race-times span {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.race-times strong {
  font-size: 0.95rem;
}

.race-board {
  display: grid;
  gap: 5px;
  max-width: 520px;
  max-height: 96px;
  margin: 8px 0 0;
  padding: 0;
  overflow: auto;
  list-style: none;
}

.race-board li {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  font-size: 0.82rem;
  font-weight: 900;
}

.race-board span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.race-board small {
  color: var(--soft-ink);
  font-size: 0.72rem;
}

.drive-controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(46px, 1fr));
  gap: 7px;
}

.drive-controls button {
  min-width: 46px;
  height: 44px;
  border: 1px solid rgba(52, 74, 51, 0.16);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #e9f6dc);
  color: var(--ink);
  font-family: inherit;
  font-weight: 950;
  touch-action: none;
}

body.track-mode .village-panel,
body.track-mode .social-panel,
body.track-mode .tile-panel,
body.track-mode .tool-dock,
body.track-mode .log {
  display: none;
}

body.track-mode .update-notice {
  bottom: 154px;
}

@media (max-width: 720px) {
  .garage-panel {
    left: 12px;
    right: 12px;
    top: 104px;
    width: auto;
    max-height: calc(100vh - 188px);
  }

  .garage-options,
  .garage-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .track-hud {
    left: 10px;
    right: 10px;
    bottom: 10px;
    grid-template-columns: 1fr;
  }

  .drive-controls {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .drive-controls button {
    min-width: 0;
    height: 42px;
    font-size: 0.86rem;
  }
}

@media (max-width: 960px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .brand {
    width: fit-content;
    min-width: 0;
    max-width: calc(100vw - 36px);
  }

  .stats {
    width: min(520px, calc(100vw - 36px));
  }

  .village-panel {
    top: auto;
    right: 18px;
    bottom: 100px;
    width: min(294px, calc(100vw - 36px));
    max-height: 196px;
  }

  .social-panel {
    display: none;
  }

  .tile-panel {
    bottom: 100px;
  }

  .log {
    display: none;
  }

  .tool-dock {
    left: 18px;
    right: 18px;
    grid-template-columns: repeat(7, minmax(50px, 1fr));
    width: auto;
    transform: none;
  }
}

@media (max-width: 720px) {
  .topbar {
    top: 10px;
    left: 10px;
    right: 10px;
  }

  h1 {
    font-size: 2.1rem;
  }

  .brand {
    padding: 10px 12px;
  }

  .brand-mark {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .stats {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
  }

  .stat {
    grid-template-columns: 28px 1fr;
    column-gap: 6px;
    padding: 8px 7px;
  }

  .stat i {
    width: 28px;
    height: 28px;
    font-size: 0.86rem;
  }

  .stat span {
    font-size: 0.68rem;
  }

  .stat strong {
    font-size: 1.14rem;
  }

  .village-panel {
    display: none;
  }

  .social-panel {
    display: none;
  }

  .tile-panel {
    left: 10px;
    bottom: 91px;
    width: calc(100vw - 20px);
    padding: 10px 12px;
  }

  .tile-panel > i {
    flex-basis: 40px;
    width: 40px;
    height: 40px;
    font-size: 1.1rem;
  }

  .tile-panel p {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .tool-dock {
    left: 10px;
    right: 10px;
    bottom: 10px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
    overflow: visible;
    padding: 7px;
  }

  .tool {
    min-width: 0;
    min-height: 62px;
    padding: 6px 4px;
  }

  .tool i {
    width: 30px;
    height: 30px;
    font-size: 0.96rem;
  }

  .tool span {
    font-size: 0.66rem;
  }

  .daybar {
    right: 10px;
    bottom: 164px;
  }

  .round-button,
  .day-button {
    min-height: 46px;
  }

  .round-button {
    width: 46px;
  }

  .day-button {
    min-width: 104px;
    padding: 0 11px;
  }

  .day-button i {
    width: 27px;
    height: 27px;
    font-size: 1rem;
  }

  .day-button strong {
    font-size: 0.84rem;
  }

  .friend-card .friend-actions:not(.account-actions) {
    grid-template-columns: 1fr;
  }

  .friend-card .friend-actions:not(.account-actions) button {
    min-height: 48px;
    justify-content: flex-start;
    padding: 0 14px;
  }

  .friend-card .friend-actions:not(.account-actions) span {
    overflow: visible;
    text-overflow: clip;
  }

  .update-notice {
    right: 10px;
    bottom: 228px;
    left: 10px;
    width: auto;
  }
}

@media (max-width: 420px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 172px;
  }

  .brand {
    max-width: 224px;
  }

  .daybar {
    bottom: 156px;
  }
}
