* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 128, 180, 0.25), transparent 32%),
    radial-gradient(circle at bottom right, rgba(255, 64, 150, 0.22), transparent 35%),
    linear-gradient(135deg, #09070b 0%, #171018 45%, #050505 100%);
  color: #f8eef4;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 22px 0;
}

.container {
  width: min(1000px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.title-area {
  text-align: center;
  margin-bottom: 0;
}

.main-title {
  margin: 0;
  font-size: clamp(26px, 4.4vw, 46px);
  font-weight: 900;
  letter-spacing: 0.04em;
  color: #ffe4ef;
  text-shadow:
    0 0 12px rgba(255, 128, 180, 0.7),
    0 0 28px rgba(255, 80, 160, 0.35);
}

.info {
  margin-top: 8px;
  font-size: clamp(12px, 1.8vw, 15px);
  line-height: 1.55;
  color: #f2b9d1;
  letter-spacing: 0.03em;
}

.display-wrap {
  width: min(720px, 100%);
  margin: 0 auto;
}

.goal-text {
  text-align: center;
  margin: 0 0 8px;
  font-size: clamp(18px, 3vw, 28px);
  font-weight: 900;
  color: #ffe4ef;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 8px rgba(255, 143, 202, 0.85),
    0 0 18px rgba(255, 80, 160, 0.45);
}

.display-area {
  display: grid;
  grid-template-rows: 112px 64px 112px;
  gap: 8px;
  width: 100%;
  margin: 0 auto;
}

.display-box {
  background: rgba(20, 16, 22, 0.88);
  border: 2px solid rgba(255, 156, 198, 0.72);
  border-radius: 16px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: clamp(38px, 6vw, 62px);
  font-weight: 900;
  padding: 10px 14px;
  text-align: center;
  color: #ffeaf2;
  box-shadow:
    inset 0 0 18px rgba(255, 128, 180, 0.08),
    0 8px 24px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}

.input-display {
  gap: 0.18em;
  white-space: nowrap;
}

.input-token {
  display: inline-block;
  transition: 0.35s ease;
}

.input-token.revealed {
  color: #ff8fca;
  text-shadow:
    0 0 8px rgba(255, 143, 202, 0.9),
    0 0 18px rgba(255, 80, 160, 0.55);
  transform: scale(1.08);
}

.arrow-row {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
}

.triangle {
  width: 0;
  height: 0;
  border-left: 48px solid transparent;
  border-right: 48px solid transparent;
  border-top: 62px solid rgba(255, 142, 190, 0.95);
  position: relative;
  filter:
    drop-shadow(0 0 10px rgba(255, 128, 180, 0.58))
    drop-shadow(0 6px 12px rgba(0, 0, 0, 0.38));
  transition: 0.45s ease;
}

.triangle-content {
  position: absolute;
  top: -58px;
  left: -48px;
  width: 96px;
  height: 48px;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #230412;
  font-size: 30px;
  font-weight: 900;
  text-align: center;
  line-height: 1;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
  transition: 0.35s ease;
}

.triangle-content.revealed {
  transform: scale(1.12);
}

.triangle.equal-mode {
  width: 96px;
  height: 62px;
  border-left: 0 solid transparent;
  border-right: 0 solid transparent;
  border-top: 0 solid transparent;
  display: flex;
  justify-content: center;
  align-items: center;
  animation: triangleToEqual 0.9s ease forwards;
}

.triangle.equal-mode .triangle-content {
  opacity: 0;
  transform: scale(0.75);
}

.triangle.equal-mode::after {
  content: "＝";
  position: absolute;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  color: #ff8fca;
  font-size: 58px;
  font-weight: 900;
  line-height: 1;
  writing-mode: vertical-rl;
  text-orientation: upright;
  opacity: 0;
  text-shadow:
    0 0 10px rgba(255, 143, 202, 0.95),
    0 0 22px rgba(255, 80, 160, 0.72);
  animation: showEqualMark 0.7s ease forwards 0.35s;
}

@keyframes triangleToEqual {
  0% {
    transform: scale(1);
    filter:
      drop-shadow(0 0 10px rgba(255, 128, 180, 0.58))
      drop-shadow(0 6px 12px rgba(0, 0, 0, 0.38));
  }

  45% {
    transform: scale(0.82) rotate(180deg);
    opacity: 0.5;
  }

  100% {
    transform: scale(1);
    opacity: 1;
    filter:
      drop-shadow(0 0 12px rgba(255, 128, 180, 0.85))
      drop-shadow(0 6px 12px rgba(0, 0, 0, 0.38));
  }
}

@keyframes showEqualMark {
  from {
    opacity: 0;
    transform: scale(0.7);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.base-label {
  position: absolute;
  left: calc(50% + 64px);
  top: 50%;
  transform: translateY(-50%) translateX(-8px);
  opacity: 0;
  color: #ffe4ef;
  font-size: clamp(20px, 3.4vw, 34px);
  font-weight: 900;
  letter-spacing: 0.05em;
  text-shadow:
    0 0 8px rgba(255, 143, 202, 0.9),
    0 0 18px rgba(255, 80, 160, 0.5);
  transition: 0.45s ease;
  white-space: nowrap;
  pointer-events: none;
}

.base-label.show {
  opacity: 1;
  transform: translateY(-50%) translateX(0);
}

.result-box {
  font-size: clamp(24px, 5vw, 56px);
  line-height: 1.15;
  color: #ffeaf2;
  overflow-wrap: anywhere;
  word-break: break-all;
  white-space: normal;
  padding: 10px 16px;
}

.result-box.has-result {
  color: #ff8fca;
  letter-spacing: 0.04em;
  text-shadow:
    0 0 8px rgba(255, 143, 202, 0.95),
    0 0 18px rgba(255, 80, 160, 0.7),
    0 0 34px rgba(255, 80, 160, 0.35);
}

.result-box.flash-clear {
  animation: clearFlash 1.1s ease-in-out;
}

.result-box.equal-result {
  animation: resultAppear 0.8s ease;
}

@keyframes resultAppear {
  0% {
    opacity: 0;
    transform: translateY(-8px) scale(0.96);
  }

  60% {
    opacity: 1;
    transform: translateY(0) scale(1.03);
  }

  100% {
    transform: scale(1);
  }
}

@keyframes clearFlash {
  0% {
    transform: scale(1);
    box-shadow:
      inset 0 0 18px rgba(255, 128, 180, 0.08),
      0 8px 24px rgba(0, 0, 0, 0.35);
  }

  35% {
    transform: scale(1.04);
    color: #ffffff;
    text-shadow:
      0 0 12px rgba(255, 255, 255, 1),
      0 0 26px rgba(255, 143, 202, 0.95),
      0 0 48px rgba(255, 80, 160, 0.75);
    box-shadow:
      inset 0 0 28px rgba(255, 180, 220, 0.25),
      0 0 24px rgba(255, 143, 202, 0.95),
      0 0 54px rgba(255, 80, 160, 0.55);
  }

  100% {
    transform: scale(1);
  }
}

.input-area {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 24px;
}

.button-cluster {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 12px 10px 10px;
}

.kuku-label {
  opacity: 0;
  writing-mode: vertical-rl;
  text-orientation: upright;
  color: #ffe4ef;
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 0.08em;
  white-space: nowrap;
  text-shadow:
    0 0 8px rgba(255, 143, 202, 0.9),
    0 0 18px rgba(255, 80, 160, 0.5);
  transition: 0.55s ease;
  pointer-events: none;
  position: relative;
  z-index: 4;
}

.kuku-label.show {
  opacity: 1;
}

.number-buttons {
  display: grid;
  grid-template-columns: repeat(6, 60px);
  gap: 10px;
  position: relative;
  z-index: 1;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

button {
  border: 2px solid rgba(255, 184, 215, 0.85);
  background: rgba(24, 18, 26, 0.94);
  color: #ffe7f1;
  cursor: pointer;
  font-weight: 800;
  transition: 0.15s;
  box-shadow:
    inset 0 0 10px rgba(255, 128, 180, 0.08),
    0 5px 16px rgba(0, 0, 0, 0.35);
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: rgba(255, 132, 184, 0.24);
  box-shadow:
    0 0 12px rgba(255, 128, 180, 0.55),
    0 8px 18px rgba(0, 0, 0, 0.42);
}

button:disabled {
  cursor: not-allowed;
  transform: none;
}

.num-btn {
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 26px;
  line-height: 1;
}

.num-btn.revealed {
  color: #ff8fca;
  border-color: #ff8fca;
  text-shadow:
    0 0 8px rgba(255, 143, 202, 0.95),
    0 0 18px rgba(255, 80, 160, 0.7);
}

.num-btn.used-disabled,
.num-btn.base-disabled,
.num-btn.final-disabled,
.enter-btn:disabled {
  background: #555;
  color: #999;
  border-color: #666;
  box-shadow: none;
  opacity: 0.65;
}

.num-btn.revealed.used-disabled,
.num-btn.revealed.base-disabled,
.num-btn.revealed.final-disabled {
  color: #ff8fca;
  border-color: #ff8fca;
  opacity: 0.95;
  background: rgba(24, 18, 26, 0.94);
  box-shadow:
    inset 0 0 10px rgba(255, 128, 180, 0.08),
    0 0 12px rgba(255, 128, 180, 0.42);
}

.enter-btn,
.reset-btn {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  font-size: 17px;
}

.enter-btn {
  background:
    linear-gradient(135deg, rgba(255, 142, 190, 0.95), rgba(240, 65, 145, 0.88));
  color: #230412;
  border-color: #ffd5e6;
}

.reset-btn {
  font-size: 15px;
}

.clear-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.62);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  padding: 20px;
}

.clear-overlay.show {
  display: flex;
}

.clear-modal {
  position: relative;
  width: min(420px, 92vw);
  background:
    radial-gradient(circle at top left, rgba(255, 160, 205, 0.26), transparent 38%),
    linear-gradient(135deg, rgba(25, 18, 28, 0.98), rgba(8, 6, 10, 0.98));
  border: 2px solid rgba(255, 184, 215, 0.95);
  border-radius: 22px;
  padding: 34px 26px 30px;
  text-align: center;
  color: #ffeaf2;
  box-shadow:
    0 0 24px rgba(255, 128, 180, 0.55),
    0 18px 48px rgba(0, 0, 0, 0.68);
  animation: modalPop 0.32s ease-out;
}

@keyframes modalPop {
  from {
    opacity: 0;
    transform: scale(0.9) translateY(10px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.clear-close {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 18px;
  line-height: 1;
  padding: 0;
  background: rgba(255, 255, 255, 0.08);
  color: #ffeaf2;
  border-color: rgba(255, 184, 215, 0.7);
  box-shadow: none;
}

.clear-heading {
  margin: 0;
  font-size: clamp(42px, 9vw, 64px);
  font-weight: 900;
  color: #ff8fca;
  letter-spacing: 0.08em;
  text-shadow:
    0 0 10px rgba(255, 143, 202, 0.95),
    0 0 24px rgba(255, 80, 160, 0.72);
}

.clear-title {
  margin: 18px 0 24px;
  font-size: clamp(18px, 4vw, 26px);
  font-weight: 800;
  color: #ffe4ef;
  line-height: 1.4;
}

.post-btn {
  width: 160px;
  height: 54px;
  border-radius: 999px;
  background:
    linear-gradient(135deg, rgba(255, 142, 190, 0.95), rgba(240, 65, 145, 0.88));
  color: #230412;
  border-color: #ffd5e6;
  font-size: 20px;
}

@media (max-width: 700px) {
  body {
    padding: 18px 0;
  }

  .container {
    gap: 14px;
  }

  .goal-text {
    margin-bottom: 6px;
    font-size: clamp(16px, 4.4vw, 22px);
  }

  .display-area {
    grid-template-rows: 84px 54px 96px;
    gap: 7px;
  }

  .display-box {
    font-size: clamp(30px, 9vw, 44px);
    border-radius: 13px;
    padding: 8px 10px;
  }

  .input-display {
    gap: 0.07em;
  }

  .result-box {
    font-size: clamp(20px, 7vw, 40px);
    line-height: 1.12;
    letter-spacing: 0.02em;
  }

  .result-box.has-result {
    letter-spacing: 0.03em;
  }

  .triangle {
    border-left-width: 38px;
    border-right-width: 38px;
    border-top-width: 48px;
  }

  .triangle-content {
    top: -45px;
    left: -38px;
    width: 76px;
    height: 38px;
    font-size: 24px;
  }

  .triangle.equal-mode {
    width: 76px;
    height: 48px;
  }

  .triangle.equal-mode::after {
    font-size: 44px;
  }

  .base-label {
    left: calc(50% + 50px);
    font-size: clamp(17px, 4.6vw, 24px);
  }

  .input-area {
    gap: 14px;
  }

  .button-cluster {
    gap: 10px;
    padding: 8px 9px 8px 8px;
  }

  .kuku-label {
    font-size: 16px;
  }

  .number-buttons {
    grid-template-columns: repeat(6, 43px);
    gap: 7px;
  }

  .num-btn {
    width: 43px;
    height: 43px;
    font-size: 20px;
  }

  .enter-btn,
  .reset-btn {
    width: 68px;
    height: 68px;
    font-size: 13px;
  }

  .reset-btn {
    font-size: 12px;
  }
}

@media (max-width: 420px) {
  .number-buttons {
    grid-template-columns: repeat(6, 38px);
    gap: 6px;
  }

  .num-btn {
    width: 38px;
    height: 38px;
    font-size: 18px;
  }

  .enter-btn,
  .reset-btn {
    width: 60px;
    height: 60px;
    font-size: 12px;
  }

  .input-area {
    gap: 10px;
  }

  .base-label {
    left: calc(50% + 43px);
    font-size: 15px;
  }

  .button-cluster {
    gap: 8px;
    padding: 7px 8px 7px 7px;
  }

  .kuku-label {
    font-size: 13px;
  }
}