* {
    box-sizing: border-box;
}

:root {
    --border-radius: 8px;

    --bg-primary: #f5f5f8;
    --bg-secondary: #ececf1;
    --text-primary: #3760bf;
    --text-secondary: #6c7086;
    --border-color: #d8d8de;
    --accent-color: #2e7de9;
    --accent-hover: #1f6feb;
    --btn-bg: #5b9cf6;
    --btn-text-color: #ececf1;
    --shadow: 0 4px 6px rgba(0, 0, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg-primary: #1a1b26;
        --bg-secondary: #16161e;
        --text-primary: #c0caf5;
        --text-secondary: #86e1a0;
        --border-color: #3b4261;
        --accent-color: #7aa2f7;
        --accent-hover: #2ac3de;
        --btn-bg: #2b2b3a;
        --btn-text-color: white;
        --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
    }
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', sans-serif;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background: var(--bg-secondary);
    color: var(--text-primary);
    text-align: center;
    padding: 20px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
    background: var(--bg-primary);
    padding: 40px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    max-width: 450px;
    width: 100%;
    transition: all 0.3s ease;
}

h1 {
    color: var(--text-primary);
    font-size: 2rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.input-group {
    margin-bottom: 20px;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    border: 2px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    background: var(--bg-secondary);
    color: var(--text-primary);
    transition: all 0.3s ease;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(255, 210, 47, 0.1);
}

.calculate-btn {
  padding: 1em 5em;
  border: none;
  outline: none;
  color: var(--btn-text-color);
  font-size: medium;
  font-weight: bolder;
  background: var(--bg-primary);
  cursor: pointer;
  position: relative;
  z-index: 0;
  border-radius: var(--border-radius);
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.calculate-btn:before {
  content: "";
  background: linear-gradient(
    45deg,
    #ff0000,
    #ff7300,
    #fffb00,
    #48ff00,
    #00ffd5,
    #002bff,
    #7a00ff,
    #ff00c8,
    #ff0000
  );
  position: absolute;
  top: -2px;
  left: -2px;
  background-size: 400%;
  z-index: -1;
  filter: blur(5px);
  -webkit-filter: blur(5px);
  width: calc(100% + 4px);
  height: calc(100% + 4px);
  animation: glowing-calculate-btn 20s linear infinite;
  transition: opacity 0.3s ease-in-out;
  border-radius: var(--border-radius);
}

@keyframes glowing-calculate-btn {
  0% {
    background-position: 0 0;
  }
  50% {
    background-position: 400% 0;
  }
  100% {
    background-position: 0 0;
  }
}

.calculate-btn:after {
  z-index: -1;
  content: "";
  position: absolute;
  width: 100%;
  height: 100%;
  background: var(--btn-bg);
  left: 0;
  top: 0;
  border-radius: var(--border-radius);
}

#result {
    color: var(--text-primary);
    margin-top: 25px;
    margin-bottom: 0px;
    font-size: 1.3rem;
    font-weight: 500;
    min-height: 1.5em;
    transition: color 0.3s ease;
}

#result.error {
    color: #f7768e;
}

.format-info {
    margin-top: 20px;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.format-info ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.format-info li {
    padding: 4px 0;
}

.copy-feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--accent-color);
    color: var(--text-primary);
    padding: 15px 30px;
    border-radius: var(--border-radius);
    font-weight: 600;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    z-index: 1000;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

@media (max-width: 500px) {
    h1 {
        font-size: 1.5rem;
    }

    .container {
        padding: 25px;
    }
}