
body {
    font-family: sans-serif;
    background-color: #f4f4f4;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 20px;
    box-sizing: border-box;
  }

  .container {
    background-color: #fff;
    padding: 30px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    text-align: center;
    max-width: 900px;
    width: 100%;
  }

  h1, h2 {
    color: #333;
    margin-bottom: 20px;
  }

  .controls {
    display: flex;
    flex-direction: column;
    gap: 30px;
    margin-bottom: 30px;
    align-items: center;
  }

  .control-group {
    width: 100%;
    max-width: 400px;
    text-align: left;
  }

  .control-group label {
    display: block;
    font-weight: bold;
    margin-bottom: 8px;
    color: #555;
  }

  input[type="file"] {
    display: block;
    width: 100%;
    padding: 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
  }

  .frame-selector {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 4px;
    justify-content: center;
    min-height: 50px;
  }

  .frame-option {
    width: 60px;
    height: 60px;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.2s ease;
    background-size: cover;
    background-position: center;
    border-radius: 3px;
  }

  .frame-option:hover {
    border-color: #aaa;
  }

  .frame-option.selected {
    border-color: #007bff;
    box-shadow: 0 0 5px rgba(0, 123, 255, 0.5);
  }

  .preview-area {
    margin-bottom: 30px;
    text-align: center;
  }

  #imageCanvas {
    border: 1px solid #ccc;
    display: block;
    margin: 15px auto 0;
    max-width: 100%;
    height: auto;
    background-color: #eee;
  }

  #instructions {
    color: #888;
    font-style: italic;
    margin-top: 10px;
  }

  .download-area {
    text-align: center;
  }

  button {
    background-color: #28a745;
    color: white;
    padding: 12px 25px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 16px;
    transition: background-color 0.2s ease;
  }

  button:hover:not(:disabled) {
    background-color: #218838;
  }

  button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
  }

  @media (min-width: 768px) {
    .container {
      display: flex;
      flex-wrap: wrap;
      justify-content: space-around;
      align-items: flex-start;
      text-align: left;
    }
    .controls {
      flex: 1;
      max-width: 350px;
      margin-right: 30px;
      margin-bottom: 0;
      align-items: flex-start;
    }
    .control-group {
      text-align: left;
      width: 100%;
    }
    .frame-selector {
      justify-content: flex-start;
    }
    .preview-area {
      flex: 1;
      max-width: 420px;
      margin-bottom: 0;
      text-align: center;
    }
    .download-area {
      width: 100%;
      margin-top: 30px;
      text-align: center;
    }
    h1 {
      width: 100%;
      text-align: center;
      margin-bottom: 40px;
    }
  }

  .modal {
    display: none;
    position: fixed;
    z-index: 999;
    padding-top: 60px;
    left: 0; top: 0;
    width: 100%; 
    height: 100%;
    max-height: 700px;
    overflow: auto;
    background-color: rgba(0,0,0,0.5);
  }

  .modal-content {
    margin: auto;
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    max-width: 600px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    text-align: center;
  }

  .close-button {
    float: right;
    font-size: 28px;
    cursor: pointer;
  }

  .modal-actions button {
    margin: 10px;
    padding: 10px 20px;
    font-size: 16px;
  }
